Skip to content

Commit 43ad071

Browse files
committed
Upgrade deno to 1.3.2 and fix lint issue
1 parent 7451540 commit 43ad071

File tree

5 files changed

+85
-14
lines changed

5 files changed

+85
-14
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- name: Install deno
2323
uses: denolib/setup-deno@master
2424
with:
25-
deno-version: 1.2.2
25+
deno-version: 1.3.2
2626
- name: Check formatting
2727
if: matrix.config.kind == 'lint'
2828
run: |

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
22
"deno.enable": true
3-
}
3+
}

README.md

Lines changed: 76 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,83 @@
11
# Mixins
22

3-
[![version](https://img.shields.io/badge/release-v0.4.0-success)](https://github.com/udibo/mixins/tree/v0.4.0)
3+
[![version](https://img.shields.io/badge/release-v0.5.0-success)](https://github.com/udibo/mixins/tree/v0.5.0)
4+
[![deno doc](https://img.shields.io/badge/deno-doc-success?logo=deno)](https://doc.deno.land/https/deno.land/x/[email protected]/mod.ts)
5+
[![deno version](https://img.shields.io/badge/deno-v1.3.2-success?logo=deno)](https://github.com/denoland/deno/tree/v1.3.2)
46
[![CI](https://github.com/udibo/mixins/workflows/CI/badge.svg)](https://github.com/udibo/mixins/actions?query=workflow%3ACI)
5-
[![deno version](https://img.shields.io/badge/deno-v1.2.2-success)](https://github.com/denoland/deno/tree/v1.2.2)
6-
[![deno doc](https://doc.deno.land/badge.svg)](https://doc.deno.land/https/raw.githubusercontent.com/udibo/mixins/v0.4.0/mod.ts)
77
[![license](https://img.shields.io/github/license/udibo/mixins)](https://github.com/udibo/mixins/blob/master/LICENSE)
88

99
This module provides a few basic functions to help combine objects or build up classes from partial classes.
1010

11+
## Features
12+
13+
- Apply mixins to objects, functions, or classes.
14+
15+
## Installation
16+
17+
This is an ES Module written in TypeScript and can be used in Deno projects. ES Modules are the official standard format to package JavaScript code for reuse. A JavaScript bundle is provided with each release so that it can be used in Node.js packages or web browsers.
18+
19+
### Deno
20+
21+
To include it in a Deno project, you can import directly from the TS files.
22+
This module is available in Deno's third part module registry
23+
but can also be imported directly from GitHub using raw content URLs.
24+
25+
```ts
26+
// Import from Deno's third party module registry
27+
import { applyMixins } from "https://deno.land/x/[email protected]/mod.ts";
28+
// Import from GitHub
29+
import { applyMixins } "https://raw.githubusercontent.com/udibo/mixins/v0.5.0/mod.ts";
30+
```
31+
32+
### Node.js
33+
34+
Node.js fully supports ES Modules.
35+
36+
If a Node.js package has the type "module" specified in its package.json file, the JavaScript bundle can be imported as a `.js` file.
37+
38+
```js
39+
import { applyMixins } from "./mixins_v0.5.0.js";
40+
```
41+
42+
The default type for Node.js packages is "commonjs".
43+
To import the bundle into a commonjs package, the file extension of the JavaScript bundle must be changed from `.js` to `.mjs`.
44+
45+
```js
46+
import { applyMixins } from "./mixins_v0.5.0.mjs";
47+
```
48+
49+
See [Node.js Documentation](https://nodejs.org/api/esm.html) for more information.
50+
51+
### Browser
52+
53+
Most modern browsers support ES Modules.
54+
55+
The JavaScript bundle can be imported into ES modules.
56+
Script tags for ES modules must have the type attribute set to "module".
57+
58+
```html
59+
<script type="module" src="main.js"></script>
60+
```
61+
62+
```js
63+
// main.js
64+
import { applyMixins } from "./mixins_v0.5.0.js";
65+
```
66+
67+
You can also embed a module script directly into an HTML file by placing the JavaScript code
68+
within the body of the script tag.
69+
70+
```html
71+
<script type="module">
72+
import { applyMixins } from "./mixins_v0.5.0.js";
73+
</script>
74+
```
75+
76+
See [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules) for more information.
77+
1178
## Usage
1279

13-
`apply.ts` module provides 3 methods for mixing objects and classes together.
80+
Below are some examples of how to use each of the functions provided by the mixins module.
1481

1582
### applyMixins
1683

@@ -19,7 +86,7 @@ Applies properties of mixins to instance.
1986
Using `applyMixins` to add properties to an object:
2087

2188
```ts
22-
import { applyMixins } from "https://raw.githubusercontent.com/udibo/mixins/v0.4.0/apply.ts";
89+
import { applyMixins } from "https://deno.land/x/mixins@v0.5.0/mod.ts";
2390
interface Point {
2491
x: number;
2592
y: number;
@@ -41,7 +108,7 @@ point3; // { time: 5, x: 2, y: 3, z: 7 }
41108
Using `applyMixins` to add properties to a function:
42109

43110
```ts
44-
import { applyMixins } from "https://raw.githubusercontent.com/udibo/mixins/v0.4.0/apply.ts";
111+
import { applyMixins } from "https://deno.land/x/mixins@v0.5.0/mod.ts";
45112
interface Point {
46113
x: number;
47114
y: number;
@@ -78,7 +145,7 @@ point3.toString(); // "2, 3, 7, 5"
78145
Using `applyMixins` to add properties to a class:
79146

80147
```ts
81-
import { applyMixins } from "https://raw.githubusercontent.com/udibo/mixins/v0.4.0/apply.ts";
148+
import { applyMixins } from "https://deno.land/x/mixins@v0.5.0/mod.ts";
82149
interface Point {
83150
x: number;
84151
y: number;
@@ -130,7 +197,7 @@ point3.toString(); // "1, 2, 3, 4"
130197
Applies properties of base class prototypes to instance.
131198

132199
```ts
133-
import { applyMixins, applyInstanceMixins } from "https://raw.githubusercontent.com/udibo/mixins/v0.4.0/apply.ts";
200+
import { applyMixins, applyInstanceMixins } from "https://deno.land/x/mixins@v0.5.0/mod.ts";
134201
class Point {
135202
constructor(public x: number, public y: number) {}
136203

@@ -177,7 +244,7 @@ point.toString(); // "2, 3, 7, 5"
177244
Applies properties of base class prototypes to class prototype.
178245

179246
```ts
180-
import { applyMixins, applyClassMixins } from "https://raw.githubusercontent.com/udibo/mixins/v0.4.0/apply.ts";
247+
import { applyMixins, applyClassMixins } from "https://deno.land/x/mixins@v0.5.0/mod.ts";
181248
class Point {
182249
constructor(public x: number, public y: number) {}
183250

apply.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@ export function applyInstanceMixins<T>(instance: T, baseCtors: any[]) {
2727
}
2828

2929
/** Applies properties of base class prototypes to class prototype. */
30-
// deno-lint-ignore no-explicit-any
31-
export function applyClassMixins(ctor: Function, baseCtors: any[]) {
30+
export function applyClassMixins<T>(
31+
// deno-lint-ignore no-explicit-any
32+
ctor: { new (...args: any[]): T },
33+
// deno-lint-ignore no-explicit-any
34+
baseCtors: any[],
35+
) {
3236
applyInstanceMixins(ctor.prototype, baseCtors);
3337
}

deps/std/testing/asserts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export { assertEquals } from "https://deno.land/std@0.63.0/testing/asserts.ts";
1+
export { assertEquals } from "https://deno.land/std@0.67.0/testing/asserts.ts";

0 commit comments

Comments
 (0)