@tsed/core 7.0.0-beta.1 → 7.0.0-beta.12
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/jest.config.js +14 -0
- package/lib/cjs/decorators/configurable.js +2 -6
- package/lib/cjs/decorators/configurable.js.map +1 -1
- package/lib/cjs/decorators/deprecated.js +2 -1
- package/lib/cjs/decorators/deprecated.js.map +1 -1
- package/lib/cjs/decorators/enumerable.js +2 -6
- package/lib/cjs/decorators/enumerable.js.map +1 -1
- package/lib/cjs/decorators/notConfigurable.js +0 -4
- package/lib/cjs/decorators/notConfigurable.js.map +1 -1
- package/lib/cjs/decorators/notEnumerable.js +0 -4
- package/lib/cjs/decorators/notEnumerable.js.map +1 -1
- package/lib/cjs/decorators/readOnly.js +0 -4
- package/lib/cjs/decorators/readOnly.js.map +1 -1
- package/lib/cjs/decorators/writable.js +2 -6
- package/lib/cjs/decorators/writable.js.map +1 -1
- package/lib/cjs/domain/AnyToPromise.js +10 -10
- package/lib/cjs/domain/AnyToPromise.js.map +1 -1
- package/lib/cjs/errors/UnsupportedDecoratorType.js +5 -3
- package/lib/cjs/errors/UnsupportedDecoratorType.js.map +1 -1
- package/lib/cjs/index.js +81 -5
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/package.json +3 -0
- package/lib/cjs/utils/decorators/decorateMethodsOf.js +1 -0
- package/lib/cjs/utils/decorators/decorateMethodsOf.js.map +1 -1
- package/lib/cjs/utils/imports/importPackage.js +5 -1
- package/lib/cjs/utils/imports/importPackage.js.map +1 -1
- package/lib/cjs/utils/objects/deepClone.js +6 -0
- package/lib/cjs/utils/objects/deepClone.js.map +1 -1
- package/lib/cjs/utils/objects/deepMerge.js.map +1 -1
- package/lib/cjs/utils/objects/getConstructorArgNames.js +6 -1
- package/lib/cjs/utils/objects/getConstructorArgNames.js.map +1 -1
- package/lib/cjs/utils/objects/getValue.js +1 -1
- package/lib/cjs/utils/objects/getValue.js.map +1 -1
- package/lib/cjs/utils/objects/isBuffer.js +13 -0
- package/lib/cjs/utils/objects/isBuffer.js.map +1 -0
- package/lib/cjs/utils/objects/isClass.js +3 -1
- package/lib/cjs/utils/objects/isClass.js.map +1 -1
- package/lib/cjs/utils/objects/methodsOf.js.map +1 -1
- package/lib/esm/decorators/configurable.js +1 -5
- package/lib/esm/decorators/configurable.js.map +1 -1
- package/lib/esm/decorators/deprecated.js +2 -1
- package/lib/esm/decorators/deprecated.js.map +1 -1
- package/lib/esm/decorators/enumerable.js +1 -5
- package/lib/esm/decorators/enumerable.js.map +1 -1
- package/lib/esm/decorators/notConfigurable.js +1 -5
- package/lib/esm/decorators/notConfigurable.js.map +1 -1
- package/lib/esm/decorators/notEnumerable.js +1 -5
- package/lib/esm/decorators/notEnumerable.js.map +1 -1
- package/lib/esm/decorators/readOnly.js +1 -5
- package/lib/esm/decorators/readOnly.js.map +1 -1
- package/lib/esm/decorators/storeFn.js +1 -1
- package/lib/esm/decorators/storeMerge.js +1 -1
- package/lib/esm/decorators/storeSet.js +1 -1
- package/lib/esm/decorators/writable.js +1 -5
- package/lib/esm/decorators/writable.js.map +1 -1
- package/lib/esm/domain/AnyToPromise.js +3 -3
- package/lib/esm/domain/Metadata.js +1 -1
- package/lib/esm/domain/Store.js +8 -8
- package/lib/esm/errors/UnsupportedDecoratorType.js +3 -1
- package/lib/esm/errors/UnsupportedDecoratorType.js.map +1 -1
- package/lib/esm/index.js +81 -5
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/package.json +3 -0
- package/lib/esm/utils/decorators/decorateMethodsOf.js +6 -5
- package/lib/esm/utils/decorators/decorateMethodsOf.js.map +1 -1
- package/lib/esm/utils/decorators/decoratorArgs.js +1 -1
- package/lib/esm/utils/decorators/decoratorTypeOf.js +2 -2
- package/lib/esm/utils/decorators/inheritedDescriptorOf.js +1 -1
- package/lib/esm/utils/decorators/useMethodDecorators.js +1 -1
- package/lib/esm/utils/objects/ancestorsOf.js +3 -3
- package/lib/esm/utils/objects/cleanObject.js +1 -1
- package/lib/esm/utils/objects/createInstance.js +1 -1
- package/lib/esm/utils/objects/deepClone.js +12 -6
- package/lib/esm/utils/objects/deepClone.js.map +1 -1
- package/lib/esm/utils/objects/deepMerge.js +5 -5
- package/lib/esm/utils/objects/deepMerge.js.map +1 -1
- package/lib/esm/utils/objects/getClassOrSymbol.js +2 -2
- package/lib/esm/utils/objects/getConstructorArgNames.js +7 -2
- package/lib/esm/utils/objects/getConstructorArgNames.js.map +1 -1
- package/lib/esm/utils/objects/getEnumerableKeys.js +2 -2
- package/lib/esm/utils/objects/getValue.js +4 -4
- package/lib/esm/utils/objects/getValue.js.map +1 -1
- package/lib/esm/utils/objects/isArrowFn.js +1 -1
- package/lib/esm/utils/objects/isBuffer.js +9 -0
- package/lib/esm/utils/objects/isBuffer.js.map +1 -0
- package/lib/esm/utils/objects/isClass.js +10 -8
- package/lib/esm/utils/objects/isClass.js.map +1 -1
- package/lib/esm/utils/objects/isCollection.js +1 -1
- package/lib/esm/utils/objects/isEmpty.js +1 -1
- package/lib/esm/utils/objects/isEnumerable.js +2 -2
- package/lib/esm/utils/objects/isInheritedFrom.js +3 -3
- package/lib/esm/utils/objects/isPlainObject.js +1 -1
- package/lib/esm/utils/objects/isPrimitive.js +3 -3
- package/lib/esm/utils/objects/isSerializable.js +5 -5
- package/lib/esm/utils/objects/methodsOf.js +3 -3
- package/lib/esm/utils/objects/methodsOf.js.map +1 -1
- package/lib/esm/utils/objects/objectKeys.js +1 -1
- package/lib/esm/utils/objects/primitiveOf.js +3 -3
- package/lib/esm/utils/objects/prototypeOf.js +1 -1
- package/lib/esm/utils/objects/setValue.js +1 -1
- package/lib/esm/utils/objects/toMap.js +2 -2
- package/lib/esm/utils/objects/toStringConstructor.js +1 -1
- package/lib/esm/utils/proxyDelegation.js +1 -1
- package/lib/types/decorators/configurable.d.ts +0 -1
- package/lib/types/decorators/enumerable.d.ts +0 -1
- package/lib/types/decorators/notConfigurable.d.ts +0 -1
- package/lib/types/decorators/notEnumerable.d.ts +0 -1
- package/lib/types/decorators/readOnly.d.ts +0 -1
- package/lib/types/decorators/writable.d.ts +0 -1
- package/lib/types/index.d.ts +80 -5
- package/lib/types/utils/objects/deepMerge.d.ts +1 -1
- package/lib/types/utils/objects/isBuffer.d.ts +7 -0
- package/lib/types/utils/objects/methodsOf.d.ts +5 -1
- package/package.json +12 -6
- package/readme.md +3 -3
- package/tsconfig.compile.esm.json +1 -12
- package/lib/cjs/decorators/index.js +0 -18
- package/lib/cjs/decorators/index.js.map +0 -1
- package/lib/cjs/domain/index.js +0 -11
- package/lib/cjs/domain/index.js.map +0 -1
- package/lib/cjs/interfaces/index.js +0 -3
- package/lib/cjs/interfaces/index.js.map +0 -1
- package/lib/cjs/utils/index.js +0 -19
- package/lib/cjs/utils/index.js.map +0 -1
- package/lib/cjs/utils/objects/index.js +0 -46
- package/lib/cjs/utils/objects/index.js.map +0 -1
- package/lib/esm/decorators/index.js +0 -15
- package/lib/esm/decorators/index.js.map +0 -1
- package/lib/esm/domain/index.js +0 -8
- package/lib/esm/domain/index.js.map +0 -1
- package/lib/esm/interfaces/index.js +0 -2
- package/lib/esm/interfaces/index.js.map +0 -1
- package/lib/esm/utils/index.js +0 -16
- package/lib/esm/utils/index.js.map +0 -1
- package/lib/esm/utils/objects/index.js +0 -43
- package/lib/esm/utils/objects/index.js.map +0 -1
- package/lib/types/decorators/index.d.ts +0 -14
- package/lib/types/domain/index.d.ts +0 -7
- package/lib/types/interfaces/index.d.ts +0 -4
- package/lib/types/utils/index.d.ts +0 -13
- package/lib/types/utils/objects/index.d.ts +0 -42
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getValue.js","sourceRoot":"","sources":["../../../../src/utils/objects/getValue.ts"],"names":[],"mappings":";;;AAAA,6CAAwC;AACxC,yCAAoC;AACpC,yCAAoC;AAEpC,MAAM,UAAU,GAAG,CAAC,IAAW,EAAE,EAAE;IACjC,MAAM,CAAC,UAAU,EAAE,KAAK,EAAE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isFunction} from \"./isFunction\";\nimport {isObject} from \"./isObject\";\nimport {isString} from \"./isString\";\n\nconst mapOptions = (args: any[]) => {\n const [expression, scope, defaultValue, separator = \".\"] = args;\n\n if (isObject(scope) || isString(expression)) {\n return {\n expression,\n scope,\n defaultValue,\n separator\n };\n }\n\n return {\n expression: scope,\n scope: expression,\n defaultValue,\n separator\n };\n};\n\n/**\n * Get value from scope\n * @param {string} expression\n * @param scope\n * @returns {any}\n */\nexport function getValue<T = any>(scope: any, expression: string | undefined): T | undefined;\n/**\n * Get value from scope\n * @param {string} expression\n * @param scope\n * @param defaultValue\n * @param separator\n * @returns {any}\n */\nexport function getValue<T = any>(scope: any, expression: string | undefined, defaultValue: T, separator?: string): T;\n/**\n * Get value from scope\n * @param {string} expression\n * @param scope\n * @returns {any}\n */\nexport function getValue<T = any>(expression: string | undefined, scope: any): T | undefined;\n/**\n * Get value from scope\n * @param {string} expression\n * @param scope\n * @param defaultValue\n * @param separator\n * @returns {any}\n */\nexport function getValue<T = any>(expression: string | undefined, scope: any, defaultValue: T, separator?: string): T;\nexport function getValue(...args: any[]) {\n const options = mapOptions(args);\n let scope = options.scope;\n const {expression, defaultValue, separator} = options;\n\n if (!expression) {\n return scope;\n }\n\n if (!scope) {\n return defaultValue;\n }\n\n const keys: string[] = expression.split(separator);\n\n const getValue = (key: string) => {\n if (scope) {\n if (scope[key] !== undefined || (isObject(scope) && key in scope)) {\n return scope[key];\n }\n\n if (isFunction(scope.get)) {\n return scope.get(key);\n }\n }\n };\n\n while ((scope = getValue(keys.shift()!)) && keys.length) {}\n\n return scope === undefined ? defaultValue : scope;\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isBuffer = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Tests to see if the object is Buffer
|
|
6
|
+
* @param target
|
|
7
|
+
* @returns {boolean}
|
|
8
|
+
*/
|
|
9
|
+
function isBuffer(target) {
|
|
10
|
+
return target === Buffer || target instanceof Buffer;
|
|
11
|
+
}
|
|
12
|
+
exports.isBuffer = isBuffer;
|
|
13
|
+
//# sourceMappingURL=isBuffer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isBuffer.js","sourceRoot":"","sources":["../../../../src/utils/objects/isBuffer.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,SAAgB,QAAQ,CAAC,MAAW;IAClC,OAAO,MAAM,KAAK,MAAM,IAAI,MAAM,YAAY,MAAM,CAAC;AACvD,CAAC;AAFD,4BAEC","sourcesContent":["/**\n * Tests to see if the object is Buffer\n * @param target\n * @returns {boolean}\n */\nexport function isBuffer(target: any): target is Buffer {\n return target === Buffer || target instanceof Buffer;\n}\n"]}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.isClass = void 0;
|
|
4
4
|
const isArray_1 = require("./isArray");
|
|
5
5
|
const isArrowFn_1 = require("./isArrowFn");
|
|
6
|
+
const isBuffer_1 = require("./isBuffer");
|
|
6
7
|
const isDate_1 = require("./isDate");
|
|
7
8
|
const isPlainObject_1 = require("./isPlainObject");
|
|
8
9
|
const isPrimitive_1 = require("./isPrimitive");
|
|
@@ -20,7 +21,8 @@ function isClass(target) {
|
|
|
20
21
|
(0, isPlainObject_1.isClassObject)(target) ||
|
|
21
22
|
(0, isDate_1.isDate)(target) ||
|
|
22
23
|
(0, isPromise_1.isPromise)(target) ||
|
|
23
|
-
(0, isArray_1.isArrayOrArrayClass)(target)
|
|
24
|
+
(0, isArray_1.isArrayOrArrayClass)(target) ||
|
|
25
|
+
(0, isBuffer_1.isBuffer)(target));
|
|
24
26
|
}
|
|
25
27
|
exports.isClass = isClass;
|
|
26
28
|
//# sourceMappingURL=isClass.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isClass.js","sourceRoot":"","sources":["../../../../src/utils/objects/isClass.ts"],"names":[],"mappings":";;;AAAA,uCAA8C;AAC9C,2CAAsC;AACtC,qCAAgC;AAChC,mDAA8C;AAC9C,+CAA0D;AAC1D,2CAAsC;AACtC,yCAAoC;AAEpC,SAAgB,OAAO,CAAC,MAAW;IACjC,IAAI,CAAC,MAAM,EAAE;QACX,OAAO,KAAK,CAAC;KACd;IAED,IAAI,IAAA,qBAAS,EAAC,MAAM,CAAC,EAAE;QACrB,OAAO,KAAK,CAAC;KACd;IAED,OAAO,CAAC,CACN,IAAA,mBAAQ,EAAC,MAAM,CAAC;QAChB,IAAA,yCAA2B,EAAC,MAAM,CAAC;QACnC,IAAA,6BAAa,EAAC,MAAM,CAAC;QACrB,IAAA,eAAM,EAAC,MAAM,CAAC;QACd,IAAA,qBAAS,EAAC,MAAM,CAAC;QACjB,IAAA,6BAAmB,EAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"isClass.js","sourceRoot":"","sources":["../../../../src/utils/objects/isClass.ts"],"names":[],"mappings":";;;AAAA,uCAA8C;AAC9C,2CAAsC;AACtC,yCAAoC;AACpC,qCAAgC;AAChC,mDAA8C;AAC9C,+CAA0D;AAC1D,2CAAsC;AACtC,yCAAoC;AAEpC,SAAgB,OAAO,CAAC,MAAW;IACjC,IAAI,CAAC,MAAM,EAAE;QACX,OAAO,KAAK,CAAC;KACd;IAED,IAAI,IAAA,qBAAS,EAAC,MAAM,CAAC,EAAE;QACrB,OAAO,KAAK,CAAC;KACd;IAED,OAAO,CAAC,CACN,IAAA,mBAAQ,EAAC,MAAM,CAAC;QAChB,IAAA,yCAA2B,EAAC,MAAM,CAAC;QACnC,IAAA,6BAAa,EAAC,MAAM,CAAC;QACrB,IAAA,eAAM,EAAC,MAAM,CAAC;QACd,IAAA,qBAAS,EAAC,MAAM,CAAC;QACjB,IAAA,6BAAmB,EAAC,MAAM,CAAC;QAC3B,IAAA,mBAAQ,EAAC,MAAM,CAAC,CACjB,CAAC;AACJ,CAAC;AAlBD,0BAkBC","sourcesContent":["import {isArrayOrArrayClass} from \"./isArray\";\nimport {isArrowFn} from \"./isArrowFn\";\nimport {isBuffer} from \"./isBuffer\";\nimport {isDate} from \"./isDate\";\nimport {isClassObject} from \"./isPlainObject\";\nimport {isPrimitiveOrPrimitiveClass} from \"./isPrimitive\";\nimport {isPromise} from \"./isPromise\";\nimport {isSymbol} from \"./isSymbol\";\n\nexport function isClass(target: any) {\n if (!target) {\n return false;\n }\n\n if (isArrowFn(target)) {\n return false;\n }\n\n return !(\n isSymbol(target) ||\n isPrimitiveOrPrimitiveClass(target) ||\n isClassObject(target) ||\n isDate(target) ||\n isPromise(target) ||\n isArrayOrArrayClass(target) ||\n isBuffer(target)\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"methodsOf.js","sourceRoot":"","sources":["../../../../src/utils/objects/methodsOf.ts"],"names":[],"mappings":";;;AAAA,uCAAkC;AAClC,+CAA0C;AAC1C,+CAA0C;
|
|
1
|
+
{"version":3,"file":"methodsOf.js","sourceRoot":"","sources":["../../../../src/utils/objects/methodsOf.ts"],"names":[],"mappings":";;;AAAA,uCAAkC;AAClC,+CAA0C;AAC1C,+CAA0C;AAG1C;;;GAGG;AACH,SAAgB,SAAS,CAAC,MAAW;IACnC,MAAM,OAAO,GAAG,IAAI,GAAG,EAAE,CAAC;IAC1B,MAAM,GAAG,IAAA,iBAAO,EAAC,MAAM,CAAC,CAAC;IAEzB,IAAA,yBAAW,EAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;QACrC,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,IAAA,yBAAW,EAAC,MAAM,CAAC,CAAC,CAAC;QAElD,IAAI,CAAC,OAAO,CAAC,CAAC,WAAmB,EAAE,EAAE;YACnC,IAAI,WAAW,KAAK,aAAa,EAAE;gBACjC,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,EAAC,MAAM,EAAE,WAAW,EAAC,CAAC,CAAC;aACjD;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;AACtC,CAAC;AAfD,8BAeC","sourcesContent":["import {classOf} from \"./classOf\";\nimport {ancestorsOf} from \"./ancestorsOf\";\nimport {prototypeOf} from \"./prototypeOf\";\nimport {Type} from \"../../domain/Type\";\n\n/**\n * Return all methods for a given class.\n * @param target\n */\nexport function methodsOf(target: any): {target: Type; propertyKey: string}[] {\n const methods = new Map();\n target = classOf(target);\n\n ancestorsOf(target).forEach((target) => {\n const keys = Reflect.ownKeys(prototypeOf(target));\n\n keys.forEach((propertyKey: string) => {\n if (propertyKey !== \"constructor\") {\n methods.set(propertyKey, {target, propertyKey});\n }\n });\n });\n\n return Array.from(methods.values());\n}\n"]}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* @module common/core
|
|
3
|
-
*/
|
|
4
|
-
import { descriptorOf } from "../utils";
|
|
5
|
-
/** */
|
|
1
|
+
import { descriptorOf } from "../utils/objects/descriptorOf.js";
|
|
6
2
|
export function Configurable(value = true) {
|
|
7
3
|
return (target, propertyKey) => {
|
|
8
4
|
const descriptor = descriptorOf(target, propertyKey) || { writable: true, enumerable: true };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configurable.js","sourceRoot":"","sources":["../../../src/decorators/configurable.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"configurable.js","sourceRoot":"","sources":["../../../src/decorators/configurable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,+BAA+B,CAAC;AAE3D,MAAM,UAAU,YAAY,CAAC,QAAiB,IAAI;IAChD,OAAO,CAAC,MAAW,EAAE,WAAmB,EAAE,EAAE;QAC1C,MAAM,UAAU,GAAG,YAAY,CAAC,MAAM,EAAE,WAAW,CAAC,IAAI,EAAC,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAC,CAAC;QAC3F,UAAU,CAAC,YAAY,GAAG,KAAK,CAAC;QAChC,MAAM,CAAC,cAAc,CAAC,CAAC,MAAM,IAAI,MAAM,CAAC,SAAS,CAAC,IAAI,MAAM,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;QAEvF,OAAO,UAAU,CAAC;IACpB,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import {descriptorOf} from \"../utils/objects/descriptorOf\";\n\nexport function Configurable(value: boolean = true): Function {\n return (target: any, propertyKey: string) => {\n const descriptor = descriptorOf(target, propertyKey) || {writable: true, enumerable: true};\n descriptor.configurable = value;\n Object.defineProperty((target && target.prototype) || target, propertyKey, descriptor);\n\n return descriptor;\n };\n}\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { deprecate } from "util";
|
|
1
2
|
/**
|
|
2
3
|
* The `@Deprecated()` decorators wraps the given method in such a way that it is marked as deprecated.
|
|
3
4
|
*
|
|
@@ -32,7 +33,7 @@
|
|
|
32
33
|
export function Deprecated(message) {
|
|
33
34
|
return (target, targetKey, descriptor) => {
|
|
34
35
|
const originalMethod = descriptor.value;
|
|
35
|
-
descriptor.value =
|
|
36
|
+
descriptor.value = deprecate(originalMethod, message);
|
|
36
37
|
return descriptor;
|
|
37
38
|
};
|
|
38
39
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deprecated.js","sourceRoot":"","sources":["../../../src/decorators/deprecated.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"deprecated.js","sourceRoot":"","sources":["../../../src/decorators/deprecated.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,MAAM,CAAC;AAE/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,UAAU,UAAU,CAAC,OAAe;IACxC,OAAO,CAAC,MAAiB,EAAE,SAAiB,EAAE,UAAwC,EAAE,EAAE;QACxF,MAAM,cAAc,GAAG,UAAU,CAAC,KAAK,CAAC;QAExC,UAAU,CAAC,KAAK,GAAG,SAAS,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;QAEtD,OAAO,UAAU,CAAC;IACpB,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import {deprecate} from \"util\";\nimport {Type} from \"../domain/Type\";\n/**\n * The `@Deprecated()` decorators wraps the given method in such a way that it is marked as deprecated.\n *\n * ```typescript\n * provide Foo {\n *\n * @Deprecated(\"Foo.method: Use Foo.method2 instead\")\n * public method() {\n *\n * }\n * ```\n *\n * When called, @Deprecated() will return a function that will emit a `DeprecationWarning` using the `process.on('warning')` event.\n * By default, this warning will be emitted and printed to `stderr` exactly once, the first time it is called. After the warning is emitted, the wrapped method is called.\n *\n * If either the `--no-deprecation` or `--no-warnings` command line flags are used, or if the `process.noDeprecation`\n * property is set to `true` prior to the first deprecation warning, the `@Deprecated()` decorators does nothing.\n *\n * If the `--trace-deprecation` or `--trace-warnings` command line flags are set, or the `process.traceDeprecation`\n * property is set to `true`, a warning and a stack trace are printed to stderr the first time the deprecated function is called.\n *\n * If the `--throw-deprecation` command line flag is set, or the `process.throwDeprecation` property is set to `true`,\n * then an exception will be thrown when the deprecated function is called.\n *\n * The `--throw-deprecation` command line flag and `process.throwDeprecation` property take precedence over `--trace-deprecation`\n * and `process.traceDeprecation`.\n *\n * @param message\n * @returns {Function}\n * @decorator\n */\nexport function Deprecated(message: string): Function {\n return (target: Type<any>, targetKey: string, descriptor: TypedPropertyDescriptor<any>) => {\n const originalMethod = descriptor.value;\n\n descriptor.value = deprecate(originalMethod, message);\n\n return descriptor;\n };\n}\n"]}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* @module common/core
|
|
3
|
-
*/
|
|
4
|
-
import { descriptorOf } from "../utils";
|
|
5
|
-
/** */
|
|
1
|
+
import { descriptorOf } from "../utils/objects/descriptorOf.js";
|
|
6
2
|
export function Enumerable(value = true) {
|
|
7
3
|
return (target, propertyKey) => {
|
|
8
4
|
const descriptor = descriptorOf(target, propertyKey) || { writable: true, configurable: true };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enumerable.js","sourceRoot":"","sources":["../../../src/decorators/enumerable.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"enumerable.js","sourceRoot":"","sources":["../../../src/decorators/enumerable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,+BAA+B,CAAC;AAE3D,MAAM,UAAU,UAAU,CAAC,QAAiB,IAAI;IAC9C,OAAO,CAAC,MAAW,EAAE,WAAmB,EAAE,EAAE;QAC1C,MAAM,UAAU,GAAG,YAAY,CAAC,MAAM,EAAE,WAAW,CAAC,IAAI,EAAC,QAAQ,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAC,CAAC;QAC7F,UAAU,CAAC,UAAU,GAAG,KAAK,CAAC;QAC9B,MAAM,CAAC,cAAc,CAAC,CAAC,MAAM,IAAI,MAAM,CAAC,SAAS,CAAC,IAAI,MAAM,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;QAEvF,OAAO,UAAU,CAAC;IACpB,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import {descriptorOf} from \"../utils/objects/descriptorOf\";\n\nexport function Enumerable(value: boolean = true): Function {\n return (target: any, propertyKey: string) => {\n const descriptor = descriptorOf(target, propertyKey) || {writable: true, configurable: true};\n descriptor.enumerable = value;\n Object.defineProperty((target && target.prototype) || target, propertyKey, descriptor);\n\n return descriptor;\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notConfigurable.js","sourceRoot":"","sources":["../../../src/decorators/notConfigurable.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"notConfigurable.js","sourceRoot":"","sources":["../../../src/decorators/notConfigurable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAE5C,MAAM,UAAU,eAAe;IAC7B,OAAO,YAAY,CAAC,KAAK,CAAC,CAAC;AAC7B,CAAC","sourcesContent":["import {Configurable} from \"./configurable\";\n\nexport function NotConfigurable(): Function {\n return Configurable(false);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notEnumerable.js","sourceRoot":"","sources":["../../../src/decorators/notEnumerable.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"notEnumerable.js","sourceRoot":"","sources":["../../../src/decorators/notEnumerable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAC;AAExC,MAAM,UAAU,aAAa;IAC3B,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC;AAC3B,CAAC","sourcesContent":["import {Enumerable} from \"./enumerable\";\n\nexport function NotEnumerable(): Function {\n return Enumerable(false);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readOnly.js","sourceRoot":"","sources":["../../../src/decorators/readOnly.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"readOnly.js","sourceRoot":"","sources":["../../../src/decorators/readOnly.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AAEpC,MAAM,UAAU,QAAQ;IACtB,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC;AACzB,CAAC","sourcesContent":["import {Writable} from \"./writable\";\n\nexport function Readonly(): Function {\n return Writable(false);\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Store } from "../domain/Store";
|
|
1
|
+
import { Store } from "../domain/Store.js";
|
|
2
2
|
/**
|
|
3
3
|
* Create a store correctly configured from the parameters given by the decorator.
|
|
4
4
|
* The `fn` can return a decorator that will be initialized with the parameters (target, propertyKey, descriptor).
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* @module common/core
|
|
3
|
-
*/
|
|
4
|
-
import { descriptorOf } from "../utils";
|
|
5
|
-
/** */
|
|
1
|
+
import { descriptorOf } from "../utils/objects/descriptorOf.js";
|
|
6
2
|
export function Writable(value = true) {
|
|
7
3
|
return (target, propertyKey) => {
|
|
8
4
|
const descriptor = descriptorOf(target, propertyKey) || { configurable: true, enumerable: true };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writable.js","sourceRoot":"","sources":["../../../src/decorators/writable.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"writable.js","sourceRoot":"","sources":["../../../src/decorators/writable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,+BAA+B,CAAC;AAE3D,MAAM,UAAU,QAAQ,CAAC,QAAiB,IAAI;IAC5C,OAAO,CAAC,MAAW,EAAE,WAAmB,EAAE,EAAE;QAC1C,MAAM,UAAU,GAAG,YAAY,CAAC,MAAM,EAAE,WAAW,CAAC,IAAI,EAAC,YAAY,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAC,CAAC;QAC/F,UAAU,CAAC,QAAQ,GAAG,KAAK,CAAC;QAC5B,MAAM,CAAC,cAAc,CAAC,CAAC,MAAM,IAAI,MAAM,CAAC,SAAS,CAAC,IAAI,MAAM,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;QAEvF,OAAO,UAAU,CAAC;IACpB,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import {descriptorOf} from \"../utils/objects/descriptorOf\";\n\nexport function Writable(value: boolean = true): Function {\n return (target: any, propertyKey: string) => {\n const descriptor = descriptorOf(target, propertyKey) || {configurable: true, enumerable: true};\n descriptor.writable = value;\n Object.defineProperty((target && target.prototype) || target, propertyKey, descriptor);\n\n return descriptor;\n };\n}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var _AnyToPromise_resolves, _AnyToPromise_rejects, _AnyToPromise_hasNextFunction, _AnyToPromise_promise;
|
|
2
2
|
import { __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
|
|
3
|
-
import { isObservable } from "../utils/objects/isObservable";
|
|
4
|
-
import { isPromise } from "../utils/objects/isPromise";
|
|
5
|
-
import { isStream } from "../utils/objects/isStream";
|
|
3
|
+
import { isObservable } from "../utils/objects/isObservable.js";
|
|
4
|
+
import { isPromise } from "../utils/objects/isPromise.js";
|
|
5
|
+
import { isStream } from "../utils/objects/isStream.js";
|
|
6
6
|
/**
|
|
7
7
|
* @ignore
|
|
8
8
|
*/
|
package/lib/esm/domain/Store.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { DecoratorTypes } from "../domain/DecoratorTypes";
|
|
2
|
-
import { decoratorTypeOf } from "../utils/decorators/decoratorTypeOf";
|
|
3
|
-
import { deepClone } from "../utils/objects/deepClone";
|
|
4
|
-
import { deepMerge } from "../utils/objects/deepMerge";
|
|
5
|
-
import { descriptorOf } from "../utils/objects/descriptorOf";
|
|
6
|
-
import { isSymbol } from "../utils/objects/isSymbol";
|
|
7
|
-
import { nameOf } from "../utils/objects/nameOf";
|
|
8
|
-
import { Metadata } from "./Metadata";
|
|
1
|
+
import { DecoratorTypes } from "../domain/DecoratorTypes.js";
|
|
2
|
+
import { decoratorTypeOf } from "../utils/decorators/decoratorTypeOf.js";
|
|
3
|
+
import { deepClone } from "../utils/objects/deepClone.js";
|
|
4
|
+
import { deepMerge } from "../utils/objects/deepMerge.js";
|
|
5
|
+
import { descriptorOf } from "../utils/objects/descriptorOf.js";
|
|
6
|
+
import { isSymbol } from "../utils/objects/isSymbol.js";
|
|
7
|
+
import { nameOf } from "../utils/objects/nameOf.js";
|
|
8
|
+
import { Metadata } from "./Metadata.js";
|
|
9
9
|
/**
|
|
10
10
|
* @ignore
|
|
11
11
|
*/
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { decoratorTypeOf } from "../utils/decorators/decoratorTypeOf.js";
|
|
2
|
+
import { classOf } from "../utils/objects/classOf.js";
|
|
3
|
+
import { nameOf } from "../utils/objects/nameOf.js";
|
|
2
4
|
export class UnsupportedDecoratorType extends Error {
|
|
3
5
|
constructor(decorator, args) {
|
|
4
6
|
super(UnsupportedDecoratorType.buildMessage(decorator, args));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnsupportedDecoratorType.js","sourceRoot":"","sources":["../../../src/errors/UnsupportedDecoratorType.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,
|
|
1
|
+
{"version":3,"file":"UnsupportedDecoratorType.js","sourceRoot":"","sources":["../../../src/errors/UnsupportedDecoratorType.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,qCAAqC,CAAC;AACpE,OAAO,EAAC,OAAO,EAAC,MAAM,0BAA0B,CAAC;AACjD,OAAO,EAAC,MAAM,EAAC,MAAM,yBAAyB,CAAC;AAE/C,MAAM,OAAO,wBAAyB,SAAQ,KAAK;IAGjD,YAAY,SAAc,EAAE,IAAW;QACrC,KAAK,CAAC,wBAAwB,CAAC,YAAY,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC;IAChE,CAAC;IAEO,MAAM,CAAC,YAAY,CAAC,SAAc,EAAE,IAAW;QACrD,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,CAAC,GAAG,IAAI,CAAC;QAE1C,MAAM,WAAW,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;QAC1C,MAAM,YAAY,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAC/C,MAAM,KAAK,GAAG,YAAY,KAAK,WAAW,CAAC,CAAC,CAAC,IAAI,GAAG,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QACrE,MAAM,IAAI,GAAG,YAAY,KAAK,WAAW,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC;QAChE,MAAM,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,GAAG,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC;QAEtD,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,GAAG,KAAK,CAAC;QAEtD,OAAO,GAAG,SAAS,CAAC,IAAI,sBAAsB,WAAW,iBAAiB,IAAI,EAAE,CAAC;IACnF,CAAC;CACF","sourcesContent":["import {decoratorTypeOf} from \"../utils/decorators/decoratorTypeOf\";\nimport {classOf} from \"../utils/objects/classOf\";\nimport {nameOf} from \"../utils/objects/nameOf\";\n\nexport class UnsupportedDecoratorType extends Error {\n name: \"UNSUPPORTED_DECORATOR_TYPE\";\n\n constructor(decorator: any, args: any[]) {\n super(UnsupportedDecoratorType.buildMessage(decorator, args));\n }\n\n private static buildMessage(decorator: any, args: any[]): string {\n const [target, propertyKey, index] = args;\n\n const bindingType = decoratorTypeOf(args);\n const shortBinding = bindingType.split(\"/\")[0];\n const param = shortBinding === \"parameter\" ? \".[\" + index + \"]\" : \"\";\n const cstr = shortBinding === \"parameter\" ? \".constructor\" : \"\";\n const method = propertyKey ? \".\" + propertyKey : cstr;\n\n const path = nameOf(classOf(target)) + method + param;\n\n return `${decorator.name} cannot be used as ${bindingType} decorator on ${path}`;\n }\n}\n"]}
|
package/lib/esm/index.js
CHANGED
|
@@ -1,6 +1,82 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export * from "./
|
|
5
|
-
export * from "./decorators";
|
|
1
|
+
/**
|
|
2
|
+
* @file Automatically generated by barrelsby.
|
|
3
|
+
*/
|
|
4
|
+
export * from "./decorators/configurable.js";
|
|
5
|
+
export * from "./decorators/deprecated.js";
|
|
6
|
+
export * from "./decorators/enumerable.js";
|
|
7
|
+
export * from "./decorators/notConfigurable.js";
|
|
8
|
+
export * from "./decorators/notEnumerable.js";
|
|
9
|
+
export * from "./decorators/readOnly.js";
|
|
10
|
+
export * from "./decorators/storeFn.js";
|
|
11
|
+
export * from "./decorators/storeMerge.js";
|
|
12
|
+
export * from "./decorators/storeSet.js";
|
|
13
|
+
export * from "./decorators/writable.js";
|
|
14
|
+
export * from "./domain/AnyToPromise.js";
|
|
15
|
+
export * from "./domain/DecoratorTypes.js";
|
|
16
|
+
export * from "./domain/Env.js";
|
|
17
|
+
export * from "./domain/Hooks.js";
|
|
18
|
+
export * from "./domain/Metadata.js";
|
|
19
|
+
export * from "./domain/Store.js";
|
|
20
|
+
export * from "./domain/Type.js";
|
|
21
|
+
export * from "./errors/UnsupportedDecoratorType.js";
|
|
22
|
+
export * from "./interfaces/AnyDecorator.js";
|
|
23
|
+
export * from "./interfaces/DecoratorParameters.js";
|
|
24
|
+
export * from "./interfaces/HashOf.js";
|
|
25
|
+
export * from "./interfaces/MetadataTypes.js";
|
|
26
|
+
export * from "./interfaces/ValueOf.js";
|
|
27
|
+
export * from "./utils/catchError.js";
|
|
28
|
+
export * from "./utils/proxyDelegation.js";
|
|
29
|
+
export * from "./utils/uniq.js";
|
|
30
|
+
export * from "./utils/decorators/decorateMethodsOf.js";
|
|
31
|
+
export * from "./utils/decorators/decoratorArgs.js";
|
|
32
|
+
export * from "./utils/decorators/decoratorTypeOf.js";
|
|
33
|
+
export * from "./utils/decorators/inheritedDescriptorOf.js";
|
|
34
|
+
export * from "./utils/decorators/useDecorators.js";
|
|
35
|
+
export * from "./utils/decorators/useMethodDecorators.js";
|
|
36
|
+
export * from "./utils/http/getHostInfoFromPort.js";
|
|
37
|
+
export * from "./utils/imports/importPackage.js";
|
|
38
|
+
export * from "./utils/objects/ancestorOf.js";
|
|
39
|
+
export * from "./utils/objects/ancestorsOf.js";
|
|
40
|
+
export * from "./utils/objects/classOf.js";
|
|
41
|
+
export * from "./utils/objects/cleanObject.js";
|
|
42
|
+
export * from "./utils/objects/constructorOf.js";
|
|
43
|
+
export * from "./utils/objects/createInstance.js";
|
|
44
|
+
export * from "./utils/objects/deepClone.js";
|
|
45
|
+
export * from "./utils/objects/deepMerge.js";
|
|
46
|
+
export * from "./utils/objects/descriptorOf.js";
|
|
47
|
+
export * from "./utils/objects/getClassOrSymbol.js";
|
|
48
|
+
export * from "./utils/objects/getConstructorArgNames.js";
|
|
49
|
+
export * from "./utils/objects/getEnumerableKeys.js";
|
|
50
|
+
export * from "./utils/objects/getValue.js";
|
|
51
|
+
export * from "./utils/objects/isArray.js";
|
|
52
|
+
export * from "./utils/objects/isArrowFn.js";
|
|
53
|
+
export * from "./utils/objects/isBoolean.js";
|
|
54
|
+
export * from "./utils/objects/isBuffer.js";
|
|
55
|
+
export * from "./utils/objects/isClass.js";
|
|
56
|
+
export * from "./utils/objects/isCollection.js";
|
|
57
|
+
export * from "./utils/objects/isDate.js";
|
|
58
|
+
export * from "./utils/objects/isEmpty.js";
|
|
59
|
+
export * from "./utils/objects/isEnumerable.js";
|
|
60
|
+
export * from "./utils/objects/isFunction.js";
|
|
61
|
+
export * from "./utils/objects/isInheritedFrom.js";
|
|
62
|
+
export * from "./utils/objects/isNil.js";
|
|
63
|
+
export * from "./utils/objects/isNumber.js";
|
|
64
|
+
export * from "./utils/objects/isObject.js";
|
|
65
|
+
export * from "./utils/objects/isObservable.js";
|
|
66
|
+
export * from "./utils/objects/isPlainObject.js";
|
|
67
|
+
export * from "./utils/objects/isPrimitive.js";
|
|
68
|
+
export * from "./utils/objects/isPromise.js";
|
|
69
|
+
export * from "./utils/objects/isProtectedKey.js";
|
|
70
|
+
export * from "./utils/objects/isSerializable.js";
|
|
71
|
+
export * from "./utils/objects/isStream.js";
|
|
72
|
+
export * from "./utils/objects/isString.js";
|
|
73
|
+
export * from "./utils/objects/isSymbol.js";
|
|
74
|
+
export * from "./utils/objects/methodsOf.js";
|
|
75
|
+
export * from "./utils/objects/nameOf.js";
|
|
76
|
+
export * from "./utils/objects/objectKeys.js";
|
|
77
|
+
export * from "./utils/objects/primitiveOf.js";
|
|
78
|
+
export * from "./utils/objects/prototypeOf.js";
|
|
79
|
+
export * from "./utils/objects/setValue.js";
|
|
80
|
+
export * from "./utils/objects/toMap.js";
|
|
81
|
+
export * from "./utils/objects/toStringConstructor.js";
|
|
6
82
|
//# sourceMappingURL=index.js.map
|
package/lib/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,mCAAmC,CAAC;AAClD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kCAAkC,CAAC;AACjD,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,cAAc,CAAC;AAC7B,cAAc,sCAAsC,CAAC;AACrD,cAAc,kCAAkC,CAAC;AACjD,cAAc,oCAAoC,CAAC;AACnD,cAAc,0CAA0C,CAAC;AACzD,cAAc,kCAAkC,CAAC;AACjD,cAAc,wCAAwC,CAAC;AACvD,cAAc,kCAAkC,CAAC;AACjD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,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orators/configurable\";\nexport * from \"./decorators/deprecated\";\nexport * from \"./decorators/enumerable\";\nexport * from \"./decorators/notConfigurable\";\nexport * from \"./decorators/notEnumerable\";\nexport * from \"./decorators/readOnly\";\nexport * from \"./decorators/storeFn\";\nexport * from \"./decorators/storeMerge\";\nexport * from \"./decorators/storeSet\";\nexport * from \"./decorators/writable\";\nexport * from \"./domain/AnyToPromise\";\nexport * from \"./domain/DecoratorTypes\";\nexport * from \"./domain/Env\";\nexport * from \"./domain/Hooks\";\nexport * from \"./domain/Metadata\";\nexport * from \"./domain/Store\";\nexport * from \"./domain/Type\";\nexport * from \"./errors/UnsupportedDecoratorType\";\nexport * from \"./interfaces/AnyDecorator\";\nexport * from \"./interfaces/DecoratorParameters\";\nexport * from \"./interfaces/HashOf\";\nexport * from \"./interfaces/MetadataTypes\";\nexport * from \"./interfaces/ValueOf\";\nexport * from \"./utils/catchError\";\nexport * from \"./utils/proxyDelegation\";\nexport * from \"./utils/uniq\";\nexport * from \"./utils/decorators/decorateMethodsOf\";\nexport * from \"./utils/decorators/decoratorArgs\";\nexport * from \"./utils/decorators/decoratorTypeOf\";\nexport * from \"./utils/decorators/inheritedDescriptorOf\";\nexport * from \"./utils/decorators/useDecorators\";\nexport * from \"./utils/decorators/useMethodDecorators\";\nexport * from \"./utils/http/getHostInfoFromPort\";\nexport * from \"./utils/imports/importPackage\";\nexport * from \"./utils/objects/ancestorOf\";\nexport * from \"./utils/objects/ancestorsOf\";\nexport * from \"./utils/objects/classOf\";\nexport * from \"./utils/objects/cleanObject\";\nexport * from \"./utils/objects/constructorOf\";\nexport * from \"./utils/objects/createInstance\";\nexport * from \"./utils/objects/deepClone\";\nexport * from \"./utils/objects/deepMerge\";\nexport * from \"./utils/objects/descriptorOf\";\nexport * from \"./utils/objects/getClassOrSymbol\";\nexport * from \"./utils/objects/getConstructorArgNames\";\nexport * from \"./utils/objects/getEnumerableKeys\";\nexport * from \"./utils/objects/getValue\";\nexport * from \"./utils/objects/isArray\";\nexport * from \"./utils/objects/isArrowFn\";\nexport * from \"./utils/objects/isBoolean\";\nexport * from \"./utils/objects/isBuffer\";\nexport * from \"./utils/objects/isClass\";\nexport * from \"./utils/objects/isCollection\";\nexport * from \"./utils/objects/isDate\";\nexport * from \"./utils/objects/isEmpty\";\nexport * from \"./utils/objects/isEnumerable\";\nexport * from \"./utils/objects/isFunction\";\nexport * from \"./utils/objects/isInheritedFrom\";\nexport * from \"./utils/objects/isNil\";\nexport * from \"./utils/objects/isNumber\";\nexport * from \"./utils/objects/isObject\";\nexport * from \"./utils/objects/isObservable\";\nexport * from \"./utils/objects/isPlainObject\";\nexport * from \"./utils/objects/isPrimitive\";\nexport * from \"./utils/objects/isPromise\";\nexport * from \"./utils/objects/isProtectedKey\";\nexport * from \"./utils/objects/isSerializable\";\nexport * from \"./utils/objects/isStream\";\nexport * from \"./utils/objects/isString\";\nexport * from \"./utils/objects/isSymbol\";\nexport * from \"./utils/objects/methodsOf\";\nexport * from \"./utils/objects/nameOf\";\nexport * from \"./utils/objects/objectKeys\";\nexport * from \"./utils/objects/primitiveOf\";\nexport * from \"./utils/objects/prototypeOf\";\nexport * from \"./utils/objects/setValue\";\nexport * from \"./utils/objects/toMap\";\nexport * from \"./utils/objects/toStringConstructor\";\n"]}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { classOf } from "../objects/classOf";
|
|
2
|
-
import { methodsOf } from "../objects/methodsOf";
|
|
3
|
-
import { prototypeOf } from "../objects/prototypeOf";
|
|
4
|
-
import { descriptorOf } from "../objects/descriptorOf";
|
|
5
|
-
import { Store } from "../../domain/Store";
|
|
1
|
+
import { classOf } from "../objects/classOf.js";
|
|
2
|
+
import { methodsOf } from "../objects/methodsOf.js";
|
|
3
|
+
import { prototypeOf } from "../objects/prototypeOf.js";
|
|
4
|
+
import { descriptorOf } from "../objects/descriptorOf.js";
|
|
5
|
+
import { Store } from "../../domain/Store.js";
|
|
6
6
|
export function decorateMethodsOf(klass, decorator) {
|
|
7
7
|
methodsOf(klass).forEach(({ target, propertyKey }) => {
|
|
8
8
|
if (target !== classOf(klass)) {
|
|
9
9
|
Object.defineProperty(prototypeOf(klass), propertyKey, {
|
|
10
|
+
writable: true,
|
|
10
11
|
value(...args) {
|
|
11
12
|
return prototypeOf(target)[propertyKey].apply(this, args);
|
|
12
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorateMethodsOf.js","sourceRoot":"","sources":["../../../../src/utils/decorators/decorateMethodsOf.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAC,SAAS,EAAC,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAC,WAAW,EAAC,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAC,YAAY,EAAC,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAC,KAAK,EAAC,MAAM,oBAAoB,CAAC;AAEzC,MAAM,UAAU,iBAAiB,CAAC,KAAU,EAAE,SAAc;IAC1D,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,EAAC,MAAM,EAAE,WAAW,EAAC,EAAE,EAAE;QACjD,IAAI,MAAM,KAAK,OAAO,CAAC,KAAK,CAAC,EAAE;YAC7B,MAAM,CAAC,cAAc,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,WAAW,EAAE;gBACrD,KAAK,CAAC,GAAG,IAAW;oBAClB,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;gBAC5D,CAAC;aACF,CAAC,CAAC;YAEH,KAAK,CAAC,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;SACxD;QAED,SAAS,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,WAAW,EAAE,YAAY,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC;IAC/E,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {classOf} from \"../objects/classOf\";\nimport {methodsOf} from \"../objects/methodsOf\";\nimport {prototypeOf} from \"../objects/prototypeOf\";\nimport {descriptorOf} from \"../objects/descriptorOf\";\nimport {Store} from \"../../domain/Store\";\n\nexport function decorateMethodsOf(klass: any, decorator: any) {\n methodsOf(klass).forEach(({target, propertyKey}) => {\n if (target !== classOf(klass)) {\n Object.defineProperty(prototypeOf(klass), propertyKey, {\n value(...args: any[]) {\n return prototypeOf(target)[propertyKey].apply(this, args);\n }\n });\n\n Store.mergeStoreMethodFrom(klass, target, propertyKey);\n }\n\n decorator(prototypeOf(klass), propertyKey, descriptorOf(klass, propertyKey));\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"decorateMethodsOf.js","sourceRoot":"","sources":["../../../../src/utils/decorators/decorateMethodsOf.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAC,SAAS,EAAC,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAC,WAAW,EAAC,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAC,YAAY,EAAC,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAC,KAAK,EAAC,MAAM,oBAAoB,CAAC;AAEzC,MAAM,UAAU,iBAAiB,CAAC,KAAU,EAAE,SAAc;IAC1D,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,EAAC,MAAM,EAAE,WAAW,EAAC,EAAE,EAAE;QACjD,IAAI,MAAM,KAAK,OAAO,CAAC,KAAK,CAAC,EAAE;YAC7B,MAAM,CAAC,cAAc,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,WAAW,EAAE;gBACrD,QAAQ,EAAE,IAAI;gBACd,KAAK,CAAC,GAAG,IAAW;oBAClB,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;gBAC5D,CAAC;aACF,CAAC,CAAC;YAEH,KAAK,CAAC,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;SACxD;QAED,SAAS,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,WAAW,EAAE,YAAY,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC;IAC/E,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {classOf} from \"../objects/classOf\";\nimport {methodsOf} from \"../objects/methodsOf\";\nimport {prototypeOf} from \"../objects/prototypeOf\";\nimport {descriptorOf} from \"../objects/descriptorOf\";\nimport {Store} from \"../../domain/Store\";\n\nexport function decorateMethodsOf(klass: any, decorator: any) {\n methodsOf(klass).forEach(({target, propertyKey}) => {\n if (target !== classOf(klass)) {\n Object.defineProperty(prototypeOf(klass), propertyKey, {\n writable: true,\n value(...args: any[]) {\n return prototypeOf(target)[propertyKey].apply(this, args);\n }\n });\n\n Store.mergeStoreMethodFrom(klass, target, propertyKey);\n }\n\n decorator(prototypeOf(klass), propertyKey, descriptorOf(klass, propertyKey));\n });\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DecoratorTypes } from "../../domain/DecoratorTypes";
|
|
2
|
-
import { classOf } from "../objects/classOf";
|
|
1
|
+
import { DecoratorTypes } from "../../domain/DecoratorTypes.js";
|
|
2
|
+
import { classOf } from "../objects/classOf.js";
|
|
3
3
|
export function decoratorTypeOf(args) {
|
|
4
4
|
const [target, propertyKey, descriptor] = args;
|
|
5
5
|
const staticType = (type) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ancestorsOf } from "../objects/ancestorsOf";
|
|
1
|
+
import { ancestorsOf } from "../objects/ancestorsOf.js";
|
|
2
2
|
export function inheritedDescriptorOf(target, propertyKey) {
|
|
3
3
|
for (const klass of ancestorsOf(target)) {
|
|
4
4
|
const descriptor = Object.getOwnPropertyDescriptor((klass && klass.prototype) || klass, propertyKey);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { classOf } from "./classOf";
|
|
2
|
-
import { getInheritedClass } from "./ancestorOf";
|
|
3
|
-
import { nameOf } from "./nameOf";
|
|
1
|
+
import { classOf } from "./classOf.js";
|
|
2
|
+
import { getInheritedClass } from "./ancestorOf.js";
|
|
3
|
+
import { nameOf } from "./nameOf.js";
|
|
4
4
|
/**
|
|
5
5
|
*
|
|
6
6
|
* @param target
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { isArray } from "./isArray";
|
|
2
|
-
import { isDate } from "./isDate";
|
|
3
|
-
import { isFunction } from "./isFunction";
|
|
4
|
-
import { isNil } from "./isNil";
|
|
5
|
-
import { isPrimitive } from "./isPrimitive";
|
|
6
|
-
import { isSymbol } from "./isSymbol";
|
|
1
|
+
import { isArray } from "./isArray.js";
|
|
2
|
+
import { isDate } from "./isDate.js";
|
|
3
|
+
import { isFunction } from "./isFunction.js";
|
|
4
|
+
import { isNil } from "./isNil.js";
|
|
5
|
+
import { isPrimitive } from "./isPrimitive.js";
|
|
6
|
+
import { isSymbol } from "./isSymbol.js";
|
|
7
|
+
import { isBuffer } from "./isBuffer.js";
|
|
7
8
|
const isBasicType = (source) => isNil(source) || isPrimitive(source) || isSymbol(source) || isFunction(source);
|
|
8
9
|
/**
|
|
9
10
|
* Return a cloned value
|
|
@@ -15,6 +16,11 @@ export function deepClone(source, stack = new WeakMap()) {
|
|
|
15
16
|
if (isBasicType(source)) {
|
|
16
17
|
return source;
|
|
17
18
|
}
|
|
19
|
+
if (isBuffer(source)) {
|
|
20
|
+
const copy = Buffer.alloc(source.length);
|
|
21
|
+
source.copy(copy);
|
|
22
|
+
return copy;
|
|
23
|
+
}
|
|
18
24
|
if (isDate(source)) {
|
|
19
25
|
return new Date(source);
|
|
20
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deepClone.js","sourceRoot":"","sources":["../../../../src/utils/objects/deepClone.ts"],"names":[],"mappings":"AAAA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M,UAAU,GAAG,MAAM,CAAC,wBAAwB,CAAC,MAAM,EAAE,GAAG,CAAE,CAAC;QAEjE,IAAI,UAAU,EAAE;YACd,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE;gBACjC,IAAI,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,UAAU,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;aAChD;iBAAM;gBACL,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,EAAE,UAAU,CAAC,CAAC;aAC9C;SACF;KACF;IAED,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;QACpB,MAAM,SAAS,GAAG,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;QACjD,OAAO,CAAC,cAAc,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;KACzC;IAED,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import {isArray} from \"./isArray\";\nimport {isDate} from \"./isDate\";\nimport {isFunction} from \"./isFunction\";\nimport {isNil} from \"./isNil\";\nimport {isPrimitive} from \"./isPrimitive\";\nimport {isSymbol} from \"./isSymbol\";\n\nconst isBasicType = (source: any) => isNil(source) || isPrimitive(source) || isSymbol(source) || isFunction(source);\n\n/**\n * Return a cloned value\n * @param source\n * @param stack\n */\nexport function deepClone(source: any, stack = new WeakMap()): any {\n let dest: any;\n\n if (isBasicType(source)) {\n return source;\n }\n\n if (isDate(source)) {\n return new Date(source);\n }\n\n const stacked = stack.get(source);\n\n if (stacked) {\n // See issue #1619\n // istanbul ignore next\n process.env.TSED_TRACK_CIRCULAR_REF && console.trace(\"Circular ref detected on deepClone\", stacked);\n return stacked;\n }\n\n if (isArray(source)) {\n dest = [];\n } else {\n dest = {};\n stack.set(source, dest);\n }\n\n for (const key in source) {\n // Use getOwnPropertyDescriptor instead of source[key] to prevent from triggering setter/getter.\n const descriptor = Object.getOwnPropertyDescriptor(source, key)!;\n\n if (descriptor) {\n if (!isFunction(descriptor.value)) {\n dest[key] = deepClone(descriptor.value, stack);\n } else {\n Object.defineProperty(dest, key, descriptor);\n }\n }\n }\n\n if (!isArray(source)) {\n const prototype = Reflect.getPrototypeOf(source);\n Reflect.setPrototypeOf(dest, prototype);\n }\n\n return dest;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"deepClone.js","sourceRoot":"","sources":["../../../../src/utils/objects/deepClone.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAClC,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAChC,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAC;AACxC,OAAO,EAAC,KAAK,EAAC,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AACpC,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AAEpC,MAAM,WAAW,GAAG,CAAC,MAAW,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,WAAW,CAAC,MAAM,CAAC,IAAI,QAAQ,CAAC,MAAM,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;AAEpH;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,MAAW,EAAE,KAAK,GAAG,IAAI,OAAO,EAAE;IAC1D,IAAI,IAAS,CAAC;IAEd,IAAI,WAAW,CAAC,MAAM,CAAC,EAAE;QACvB,OAAO,MAAM,CAAC;KACf;IAED,IAAI,QAAQ,CAAC,MAAM,CAAC,EAAE;QACpB,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACzC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAClB,OAAO,IAAI,CAAC;KACb;IAED,IAAI,MAAM,CAAC,MAAM,CAAC,EAAE;QAClB,OAAO,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC;KACzB;IAED,MAAM,OAAO,GAAG,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAElC,IAAI,OAAO,EAAE;QACX,kBAAkB;QAClB,uBAAuB;QACvB,OAAO,CAAC,GAAG,CAAC,uBAAuB,IAAI,OAAO,CAAC,KAAK,CAAC,oCAAoC,EAAE,OAAO,CAAC,CAAC;QACpG,OAAO,OAAO,CAAC;KAChB;IAED,IAAI,OAAO,CAAC,MAAM,CAAC,EAAE;QACnB,IAAI,GAAG,EAAE,CAAC;KACX;SAAM;QACL,IAAI,GAAG,EAAE,CAAC;QACV,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;KACzB;IAED,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE;QACxB,gGAAgG;QAChG,MAAM,UAAU,GAAG,MAAM,CAAC,wBAAwB,CAAC,MAAM,EAAE,GAAG,CAAE,CAAC;QAEjE,IAAI,UAAU,EAAE;YACd,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE;gBACjC,IAAI,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,UAAU,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;aAChD;iBAAM;gBACL,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,EAAE,UAAU,CAAC,CAAC;aAC9C;SACF;KACF;IAED,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;QACpB,MAAM,SAAS,GAAG,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;QACjD,OAAO,CAAC,cAAc,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;KACzC;IAED,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import {isArray} from \"./isArray\";\nimport {isDate} from \"./isDate\";\nimport {isFunction} from \"./isFunction\";\nimport {isNil} from \"./isNil\";\nimport {isPrimitive} from \"./isPrimitive\";\nimport {isSymbol} from \"./isSymbol\";\nimport {isBuffer} from \"./isBuffer\";\n\nconst isBasicType = (source: any) => isNil(source) || isPrimitive(source) || isSymbol(source) || isFunction(source);\n\n/**\n * Return a cloned value\n * @param source\n * @param stack\n */\nexport function deepClone(source: any, stack = new WeakMap()): any {\n let dest: any;\n\n if (isBasicType(source)) {\n return source;\n }\n\n if (isBuffer(source)) {\n const copy = Buffer.alloc(source.length);\n source.copy(copy);\n return copy;\n }\n\n if (isDate(source)) {\n return new Date(source);\n }\n\n const stacked = stack.get(source);\n\n if (stacked) {\n // See issue #1619\n // istanbul ignore next\n process.env.TSED_TRACK_CIRCULAR_REF && console.trace(\"Circular ref detected on deepClone\", stacked);\n return stacked;\n }\n\n if (isArray(source)) {\n dest = [];\n } else {\n dest = {};\n stack.set(source, dest);\n }\n\n for (const key in source) {\n // Use getOwnPropertyDescriptor instead of source[key] to prevent from triggering setter/getter.\n const descriptor = Object.getOwnPropertyDescriptor(source, key)!;\n\n if (descriptor) {\n if (!isFunction(descriptor.value)) {\n dest[key] = deepClone(descriptor.value, stack);\n } else {\n Object.defineProperty(dest, key, descriptor);\n }\n }\n }\n\n if (!isArray(source)) {\n const prototype = Reflect.getPrototypeOf(source);\n Reflect.setPrototypeOf(dest, prototype);\n }\n\n return dest;\n}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { createInstance } from "./createInstance";
|
|
2
|
-
import { isFunction } from "./isFunction";
|
|
3
|
-
import { isPrimitive } from "./isPrimitive";
|
|
4
|
-
import { isSymbol } from "./isSymbol";
|
|
5
|
-
import { objectKeys } from "./objectKeys";
|
|
1
|
+
import { createInstance } from "./createInstance.js";
|
|
2
|
+
import { isFunction } from "./isFunction.js";
|
|
3
|
+
import { isPrimitive } from "./isPrimitive.js";
|
|
4
|
+
import { isSymbol } from "./isSymbol.js";
|
|
5
|
+
import { objectKeys } from "./objectKeys.js";
|
|
6
6
|
export function mergeReducerBuilder(cb) {
|
|
7
7
|
return (collection, value, options) => {
|
|
8
8
|
const index = collection.findIndex((item) => cb(item, value));
|