@poppinss/utils 4.0.2 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/helpers.js +5 -1
- package/build/index.js +5 -1
- package/build/src/Helpers/compose.d.ts +12 -5
- package/build/src/Helpers/compose.js +2 -7
- package/build/src/Helpers/index.d.ts +1 -0
- package/build/src/Helpers/index.js +7 -2
- package/build/src/Helpers/string.js +5 -1
- package/package.json +14 -13
package/build/helpers.js
CHANGED
|
@@ -9,7 +9,11 @@
|
|
|
9
9
|
*/
|
|
10
10
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
11
11
|
if (k2 === undefined) k2 = k;
|
|
12
|
-
Object.
|
|
12
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
13
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
14
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
15
|
+
}
|
|
16
|
+
Object.defineProperty(o, k2, desc);
|
|
13
17
|
}) : (function(o, m, k, k2) {
|
|
14
18
|
if (k2 === undefined) k2 = k;
|
|
15
19
|
o[k2] = m[k];
|
package/build/index.js
CHANGED
|
@@ -9,7 +9,11 @@
|
|
|
9
9
|
*/
|
|
10
10
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
11
11
|
if (k2 === undefined) k2 = k;
|
|
12
|
-
Object.
|
|
12
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
13
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
14
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
15
|
+
}
|
|
16
|
+
Object.defineProperty(o, k2, desc);
|
|
13
17
|
}) : (function(o, m, k, k2) {
|
|
14
18
|
if (k2 === undefined) k2 = k;
|
|
15
19
|
o[k2] = m[k];
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
declare type Constructor = new (...args: any[]) => any;
|
|
2
|
-
/**
|
|
3
|
-
* Converting unions to intersection
|
|
4
|
-
*/
|
|
5
|
-
declare type UnionToIntersection<T> = (T extends any ? (x: T) => any : never) extends (x: infer R) => any ? R : never;
|
|
6
2
|
/**
|
|
7
3
|
* Normalizes constructor to work with mixins. There is an open bug for mixins
|
|
8
4
|
* to allow constructors other than `...args: any[]`
|
|
@@ -12,10 +8,21 @@ declare type UnionToIntersection<T> = (T extends any ? (x: T) => any : never) ex
|
|
|
12
8
|
export declare type NormalizeConstructor<T extends Constructor> = {
|
|
13
9
|
new (...args: any[]): InstanceType<T>;
|
|
14
10
|
} & Omit<T, 'constructor'>;
|
|
11
|
+
export interface UnaryFunction<T, R> {
|
|
12
|
+
(source: T): R;
|
|
13
|
+
}
|
|
15
14
|
/**
|
|
16
15
|
* Compose a class by applying mixins to it.
|
|
17
16
|
* The code is inspired by https://justinfagnani.com/2015/12/21/real-mixins-with-javascript-classes/, its
|
|
18
17
|
* just that I have added the support for static types too.
|
|
19
18
|
*/
|
|
20
|
-
export declare
|
|
19
|
+
export declare function compose<T extends Constructor, A>(superclass: T, mixin: UnaryFunction<T, A>): A;
|
|
20
|
+
export declare function compose<T extends Constructor, A, B>(superclass: T, mixin: UnaryFunction<T, A>, mixinB: UnaryFunction<A, B>): B;
|
|
21
|
+
export declare function compose<T extends Constructor, A, B, C>(superclass: T, mixin: UnaryFunction<T, A>, mixinB: UnaryFunction<A, B>, mixinC: UnaryFunction<B, C>): C;
|
|
22
|
+
export declare function compose<T extends Constructor, A, B, C, D>(superclass: T, mixin: UnaryFunction<T, A>, mixinB: UnaryFunction<A, B>, mixinC: UnaryFunction<B, C>, mixinD: UnaryFunction<C, D>): D;
|
|
23
|
+
export declare function compose<T extends Constructor, A, B, C, D, E>(superclass: T, mixin: UnaryFunction<T, A>, mixinB: UnaryFunction<A, B>, mixinC: UnaryFunction<B, C>, mixinD: UnaryFunction<C, D>, mixinE: UnaryFunction<D, E>): E;
|
|
24
|
+
export declare function compose<T extends Constructor, A, B, C, D, E, F>(superclass: T, mixin: UnaryFunction<T, A>, mixinB: UnaryFunction<A, B>, mixinC: UnaryFunction<B, C>, mixinD: UnaryFunction<C, D>, mixinF: UnaryFunction<E, F>): F;
|
|
25
|
+
export declare function compose<T extends Constructor, A, B, C, D, E, F, G>(superclass: T, mixin: UnaryFunction<T, A>, mixinB: UnaryFunction<A, B>, mixinC: UnaryFunction<B, C>, mixinD: UnaryFunction<C, D>, mixinF: UnaryFunction<E, F>, mixinG: UnaryFunction<F, G>): G;
|
|
26
|
+
export declare function compose<T extends Constructor, A, B, C, D, E, F, G, H>(superclass: T, mixin: UnaryFunction<T, A>, mixinB: UnaryFunction<A, B>, mixinC: UnaryFunction<B, C>, mixinD: UnaryFunction<C, D>, mixinF: UnaryFunction<E, F>, mixinG: UnaryFunction<F, G>, mixinH: UnaryFunction<G, H>): H;
|
|
27
|
+
export declare function compose<T extends Constructor, A, B, C, D, E, F, G, H, I>(superclass: T, mixin: UnaryFunction<T, A>, mixinB: UnaryFunction<A, B>, mixinC: UnaryFunction<B, C>, mixinD: UnaryFunction<C, D>, mixinF: UnaryFunction<E, F>, mixinG: UnaryFunction<F, G>, mixinH: UnaryFunction<G, H>, mixinI: UnaryFunction<H, I>): I;
|
|
21
28
|
export {};
|
|
@@ -9,12 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
11
|
exports.compose = void 0;
|
|
12
|
-
|
|
13
|
-
* Compose a class by applying mixins to it.
|
|
14
|
-
* The code is inspired by https://justinfagnani.com/2015/12/21/real-mixins-with-javascript-classes/, its
|
|
15
|
-
* just that I have added the support for static types too.
|
|
16
|
-
*/
|
|
17
|
-
const compose = (superclass, ...mixins) => {
|
|
12
|
+
function compose(superclass, ...mixins) {
|
|
18
13
|
return mixins.reduce((c, mixin) => mixin(c), superclass);
|
|
19
|
-
}
|
|
14
|
+
}
|
|
20
15
|
exports.compose = compose;
|
|
@@ -9,7 +9,11 @@
|
|
|
9
9
|
*/
|
|
10
10
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
11
11
|
if (k2 === undefined) k2 = k;
|
|
12
|
-
Object.
|
|
12
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
13
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
14
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
15
|
+
}
|
|
16
|
+
Object.defineProperty(o, k2, desc);
|
|
13
17
|
}) : (function(o, m, k, k2) {
|
|
14
18
|
if (k2 === undefined) k2 = k;
|
|
15
19
|
o[k2] = m[k];
|
|
@@ -30,9 +34,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
30
34
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
31
35
|
};
|
|
32
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
-
exports.types = exports.string = exports.safeEqual = exports.resolveFrom = exports.resolveDir = exports.requireAll = exports.ObjectBuilder = exports.MessageBuilder = exports.interpolate = exports.fsReadAll = exports.compose = exports.base64 = exports.cuid = void 0;
|
|
37
|
+
exports.types = exports.string = exports.safeEqual = exports.resolveFrom = exports.resolveDir = exports.requireAll = exports.ObjectBuilder = exports.MessageBuilder = exports.interpolate = exports.fsReadAll = exports.compose = exports.base64 = exports.file = exports.cuid = void 0;
|
|
34
38
|
var cuid_1 = require("cuid");
|
|
35
39
|
Object.defineProperty(exports, "cuid", { enumerable: true, get: function () { return __importDefault(cuid_1).default; } });
|
|
40
|
+
exports.file = __importStar(require("@poppinss/file-generator"));
|
|
36
41
|
var base64_1 = require("./base64");
|
|
37
42
|
Object.defineProperty(exports, "base64", { enumerable: true, get: function () { return base64_1.base64; } });
|
|
38
43
|
var compose_1 = require("./compose");
|
|
@@ -9,7 +9,11 @@
|
|
|
9
9
|
*/
|
|
10
10
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
11
11
|
if (k2 === undefined) k2 = k;
|
|
12
|
-
Object.
|
|
12
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
13
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
14
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
15
|
+
}
|
|
16
|
+
Object.defineProperty(o, k2, desc);
|
|
13
17
|
}) : (function(o, m, k, k2) {
|
|
14
18
|
if (k2 === undefined) k2 = k;
|
|
15
19
|
o[k2] = m[k];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@poppinss/utils",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "Handy utilities for repetitive work",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"files": [
|
|
@@ -32,28 +32,28 @@
|
|
|
32
32
|
"author": "virk,poppinss",
|
|
33
33
|
"license": "MIT",
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@adonisjs/mrm-preset": "^5.0.
|
|
36
|
-
"@adonisjs/require-ts": "^2.0.
|
|
37
|
-
"@poppinss/dev-utils": "^2.0.
|
|
35
|
+
"@adonisjs/mrm-preset": "^5.0.3",
|
|
36
|
+
"@adonisjs/require-ts": "^2.0.11",
|
|
37
|
+
"@poppinss/dev-utils": "^2.0.3",
|
|
38
38
|
"@types/fs-readdir-recursive": "^1.0.0",
|
|
39
|
-
"@types/lodash": "^4.14.
|
|
39
|
+
"@types/lodash": "^4.14.181",
|
|
40
40
|
"@types/ms": "^0.7.31",
|
|
41
|
-
"@types/node": "^17.0.
|
|
41
|
+
"@types/node": "^17.0.23",
|
|
42
42
|
"@types/pluralize": "0.0.29",
|
|
43
43
|
"@types/require-all": "^3.0.3",
|
|
44
44
|
"del-cli": "^4.0.1",
|
|
45
45
|
"doctoc": "^2.1.0",
|
|
46
|
-
"eslint": "^8.
|
|
47
|
-
"eslint-config-prettier": "^8.
|
|
46
|
+
"eslint": "^8.13.0",
|
|
47
|
+
"eslint-config-prettier": "^8.5.0",
|
|
48
48
|
"eslint-plugin-adonis": "^2.1.0",
|
|
49
49
|
"eslint-plugin-prettier": "^4.0.0",
|
|
50
|
-
"github-label-sync": "^2.0
|
|
50
|
+
"github-label-sync": "^2.2.0",
|
|
51
51
|
"husky": "^7.0.4",
|
|
52
52
|
"japa": "^4.0.0",
|
|
53
|
-
"mrm": "^
|
|
54
|
-
"np": "^7.6.
|
|
55
|
-
"prettier": "^2.
|
|
56
|
-
"typescript": "^4.
|
|
53
|
+
"mrm": "^4.0.0",
|
|
54
|
+
"np": "^7.6.1",
|
|
55
|
+
"prettier": "^2.6.2",
|
|
56
|
+
"typescript": "^4.6.3"
|
|
57
57
|
},
|
|
58
58
|
"nyc": {
|
|
59
59
|
"exclude": [
|
|
@@ -73,6 +73,7 @@
|
|
|
73
73
|
"anyBranch": false
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
|
+
"@poppinss/file-generator": "^1.0.2",
|
|
76
77
|
"@types/bytes": "^3.1.1",
|
|
77
78
|
"@types/he": "^1.1.2",
|
|
78
79
|
"bytes": "^3.1.2",
|