@tsed/core 6.97.2 → 7.0.0-beta.2

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.
@@ -7,7 +7,6 @@ const tslib_1 = require("tslib");
7
7
  (0, tslib_1.__exportStar)(require("./cleanObject"), exports);
8
8
  (0, tslib_1.__exportStar)(require("./constructorOf"), exports);
9
9
  (0, tslib_1.__exportStar)(require("./deepClone"), exports);
10
- (0, tslib_1.__exportStar)(require("./deepExtends"), exports);
11
10
  (0, tslib_1.__exportStar)(require("./deepMerge"), exports);
12
11
  (0, tslib_1.__exportStar)(require("./getClassOrSymbol"), exports);
13
12
  (0, tslib_1.__exportStar)(require("./getConstructorArgNames"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/utils/objects/index.ts"],"names":[],"mappings":";;;AAAA,4DAA6B;AAC7B,6DAA8B;AAC9B,yDAA0B;AAC1B,6DAA8B;AAC9B,+DAAgC;AAChC,2DAA4B;AAC5B,6DAA8B;AAC9B,2DAA4B;AAC5B,kEAAmC;AACnC,wEAAyC;AACzC,mEAAoC;AACpC,4DAA6B;AAC7B,0DAA2B;AAC3B,yDAA0B;AAC1B,2DAA4B;AAC5B,2DAA4B;AAC5B,yDAA0B;AAC1B,8DAA+B;AAC/B,wDAAyB;AACzB,yDAA0B;AAC1B,8DAA+B;AAC/B,4DAA6B;AAC7B,iEAAkC;AAClC,uDAAwB;AACxB,0DAA2B;AAC3B,0DAA2B;AAC3B,8DAA+B;AAC/B,+DAAgC;AAChC,6DAA8B;AAC9B,2DAA4B;AAC5B,gEAAiC;AACjC,0DAA2B;AAC3B,0DAA2B;AAC3B,0DAA2B;AAC3B,gEAAiC;AACjC,2DAA4B;AAC5B,wDAAyB;AACzB,4DAA6B;AAC7B,6DAA8B;AAC9B,6DAA8B;AAC9B,0DAA2B;AAC3B,uDAAwB;AACxB,qEAAsC","sourcesContent":["export * from \"./ancestorOf\";\nexport * from \"./ancestorsOf\";\nexport * from \"./classOf\";\nexport * from \"./cleanObject\";\nexport * from \"./constructorOf\";\nexport * from \"./deepClone\";\nexport * from \"./deepExtends\";\nexport * from \"./deepMerge\";\nexport * from \"./getClassOrSymbol\";\nexport * from \"./getConstructorArgNames\";\nexport * from \"./getEnumerableKeys\";\nexport * from \"./ancestorOf\";\nexport * from \"./getValue\";\nexport * from \"./isArray\";\nexport * from \"./isArrowFn\";\nexport * from \"./isBoolean\";\nexport * from \"./isClass\";\nexport * from \"./isCollection\";\nexport * from \"./isDate\";\nexport * from \"./isEmpty\";\nexport * from \"./isEnumerable\";\nexport * from \"./isFunction\";\nexport * from \"./isInheritedFrom\";\nexport * from \"./isNil\";\nexport * from \"./isNumber\";\nexport * from \"./isObject\";\nexport * from \"./isObservable\";\nexport * from \"./isPlainObject\";\nexport * from \"./isPrimitive\";\nexport * from \"./isPromise\";\nexport * from \"./isProtectedKey\";\nexport * from \"./isStream\";\nexport * from \"./isString\";\nexport * from \"./isSymbol\";\nexport * from \"./isSerializable\";\nexport * from \"./methodsOf\";\nexport * from \"./nameOf\";\nexport * from \"./objectKeys\";\nexport * from \"./primitiveOf\";\nexport * from \"./prototypeOf\";\nexport * from \"./setValue\";\nexport * from \"./toMap\";\nexport * from \"./toStringConstructor\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/utils/objects/index.ts"],"names":[],"mappings":";;;AAAA,4DAA6B;AAC7B,6DAA8B;AAC9B,yDAA0B;AAC1B,6DAA8B;AAC9B,+DAAgC;AAChC,2DAA4B;AAC5B,2DAA4B;AAC5B,kEAAmC;AACnC,wEAAyC;AACzC,mEAAoC;AACpC,4DAA6B;AAC7B,0DAA2B;AAC3B,yDAA0B;AAC1B,2DAA4B;AAC5B,2DAA4B;AAC5B,yDAA0B;AAC1B,8DAA+B;AAC/B,wDAAyB;AACzB,yDAA0B;AAC1B,8DAA+B;AAC/B,4DAA6B;AAC7B,iEAAkC;AAClC,uDAAwB;AACxB,0DAA2B;AAC3B,0DAA2B;AAC3B,8DAA+B;AAC/B,+DAAgC;AAChC,6DAA8B;AAC9B,2DAA4B;AAC5B,gEAAiC;AACjC,0DAA2B;AAC3B,0DAA2B;AAC3B,0DAA2B;AAC3B,gEAAiC;AACjC,2DAA4B;AAC5B,wDAAyB;AACzB,4DAA6B;AAC7B,6DAA8B;AAC9B,6DAA8B;AAC9B,0DAA2B;AAC3B,uDAAwB;AACxB,qEAAsC","sourcesContent":["export * from \"./ancestorOf\";\nexport * from \"./ancestorsOf\";\nexport * from \"./classOf\";\nexport * from \"./cleanObject\";\nexport * from \"./constructorOf\";\nexport * from \"./deepClone\";\nexport * from \"./deepMerge\";\nexport * from \"./getClassOrSymbol\";\nexport * from \"./getConstructorArgNames\";\nexport * from \"./getEnumerableKeys\";\nexport * from \"./ancestorOf\";\nexport * from \"./getValue\";\nexport * from \"./isArray\";\nexport * from \"./isArrowFn\";\nexport * from \"./isBoolean\";\nexport * from \"./isClass\";\nexport * from \"./isCollection\";\nexport * from \"./isDate\";\nexport * from \"./isEmpty\";\nexport * from \"./isEnumerable\";\nexport * from \"./isFunction\";\nexport * from \"./isInheritedFrom\";\nexport * from \"./isNil\";\nexport * from \"./isNumber\";\nexport * from \"./isObject\";\nexport * from \"./isObservable\";\nexport * from \"./isPlainObject\";\nexport * from \"./isPrimitive\";\nexport * from \"./isPromise\";\nexport * from \"./isProtectedKey\";\nexport * from \"./isStream\";\nexport * from \"./isString\";\nexport * from \"./isSymbol\";\nexport * from \"./isSerializable\";\nexport * from \"./methodsOf\";\nexport * from \"./nameOf\";\nexport * from \"./objectKeys\";\nexport * from \"./primitiveOf\";\nexport * from \"./prototypeOf\";\nexport * from \"./setValue\";\nexport * from \"./toMap\";\nexport * from \"./toStringConstructor\";\n"]}
@@ -4,7 +4,6 @@ export * from "./classOf";
4
4
  export * from "./cleanObject";
5
5
  export * from "./constructorOf";
6
6
  export * from "./deepClone";
7
- export * from "./deepExtends";
8
7
  export * from "./deepMerge";
9
8
  export * from "./getClassOrSymbol";
10
9
  export * from "./getConstructorArgNames";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/utils/objects/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,uBAAuB,CAAC","sourcesContent":["export * from \"./ancestorOf\";\nexport * from \"./ancestorsOf\";\nexport * from \"./classOf\";\nexport * from \"./cleanObject\";\nexport * from \"./constructorOf\";\nexport * from \"./deepClone\";\nexport * from \"./deepExtends\";\nexport * from \"./deepMerge\";\nexport * from \"./getClassOrSymbol\";\nexport * from \"./getConstructorArgNames\";\nexport * from \"./getEnumerableKeys\";\nexport * from \"./ancestorOf\";\nexport * from \"./getValue\";\nexport * from \"./isArray\";\nexport * from \"./isArrowFn\";\nexport * from \"./isBoolean\";\nexport * from \"./isClass\";\nexport * from \"./isCollection\";\nexport * from \"./isDate\";\nexport * from \"./isEmpty\";\nexport * from \"./isEnumerable\";\nexport * from \"./isFunction\";\nexport * from \"./isInheritedFrom\";\nexport * from \"./isNil\";\nexport * from \"./isNumber\";\nexport * from \"./isObject\";\nexport * from \"./isObservable\";\nexport * from \"./isPlainObject\";\nexport * from \"./isPrimitive\";\nexport * from \"./isPromise\";\nexport * from \"./isProtectedKey\";\nexport * from \"./isStream\";\nexport * from \"./isString\";\nexport * from \"./isSymbol\";\nexport * from \"./isSerializable\";\nexport * from \"./methodsOf\";\nexport * from \"./nameOf\";\nexport * from \"./objectKeys\";\nexport * from \"./primitiveOf\";\nexport * from \"./prototypeOf\";\nexport * from \"./setValue\";\nexport * from \"./toMap\";\nexport * from \"./toStringConstructor\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/utils/objects/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,uBAAuB,CAAC","sourcesContent":["export * from \"./ancestorOf\";\nexport * from \"./ancestorsOf\";\nexport * from \"./classOf\";\nexport * from \"./cleanObject\";\nexport * from \"./constructorOf\";\nexport * from \"./deepClone\";\nexport * from \"./deepMerge\";\nexport * from \"./getClassOrSymbol\";\nexport * from \"./getConstructorArgNames\";\nexport * from \"./getEnumerableKeys\";\nexport * from \"./ancestorOf\";\nexport * from \"./getValue\";\nexport * from \"./isArray\";\nexport * from \"./isArrowFn\";\nexport * from \"./isBoolean\";\nexport * from \"./isClass\";\nexport * from \"./isCollection\";\nexport * from \"./isDate\";\nexport * from \"./isEmpty\";\nexport * from \"./isEnumerable\";\nexport * from \"./isFunction\";\nexport * from \"./isInheritedFrom\";\nexport * from \"./isNil\";\nexport * from \"./isNumber\";\nexport * from \"./isObject\";\nexport * from \"./isObservable\";\nexport * from \"./isPlainObject\";\nexport * from \"./isPrimitive\";\nexport * from \"./isPromise\";\nexport * from \"./isProtectedKey\";\nexport * from \"./isStream\";\nexport * from \"./isString\";\nexport * from \"./isSymbol\";\nexport * from \"./isSerializable\";\nexport * from \"./methodsOf\";\nexport * from \"./nameOf\";\nexport * from \"./objectKeys\";\nexport * from \"./primitiveOf\";\nexport * from \"./prototypeOf\";\nexport * from \"./setValue\";\nexport * from \"./toMap\";\nexport * from \"./toStringConstructor\";\n"]}
@@ -4,7 +4,6 @@ export * from "./classOf";
4
4
  export * from "./cleanObject";
5
5
  export * from "./constructorOf";
6
6
  export * from "./deepClone";
7
- export * from "./deepExtends";
8
7
  export * from "./deepMerge";
9
8
  export * from "./getClassOrSymbol";
10
9
  export * from "./getConstructorArgNames";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsed/core",
3
- "version": "6.97.2",
3
+ "version": "7.0.0-beta.2",
4
4
  "description": "Core module for Ts.ED Framework",
5
5
  "private": false,
6
6
  "source": "./src/index.ts",
@@ -27,7 +27,7 @@
27
27
  "bugs": {
28
28
  "url": "https://github.com/tsedio/tsed/issues"
29
29
  },
30
- "homepage": "https://github.com/tsedio/tsed/tree/production/packages/core",
30
+ "homepage": "https://github.com/tsedio/tsed/tree/alpha/packages/core",
31
31
  "author": "Romain Lenzotti",
32
32
  "license": "MIT"
33
33
  }
@@ -1,79 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deepExtends = void 0;
4
- const createInstance_1 = require("./createInstance");
5
- const isArray_1 = require("./isArray");
6
- const isPrimitive_1 = require("./isPrimitive");
7
- const objectKeys_1 = require("./objectKeys");
8
- function reducer() {
9
- return (collection, value) => {
10
- collection.indexOf(value) === -1 && collection.push(value);
11
- return collection;
12
- };
13
- }
14
- /**
15
- * Deep extends a model with another one.
16
- * @param out
17
- * @param obj
18
- * @param reducers
19
- * @returns {any}
20
- * @deprecated Since 2021-07-16. Use deepMerge instead of
21
- */
22
- function deepExtends(out, obj, reducers = {}) {
23
- if (obj === undefined || obj === null) {
24
- return out;
25
- }
26
- if ((0, isPrimitive_1.isPrimitive)(obj) || typeof obj === "symbol" || typeof obj === "function") {
27
- return obj;
28
- }
29
- if ((0, isArray_1.isArrayOrArrayClass)(obj)) {
30
- out = out || [];
31
- }
32
- else {
33
- out = out || (0, createInstance_1.createInstance)(obj);
34
- }
35
- const defaultReducer = reducers["default"] ? reducers["default"] : reducer();
36
- const set = (key, value) => {
37
- if ((0, isArray_1.isArrayOrArrayClass)(obj)) {
38
- out.indexOf(value) === -1 && out.push(value);
39
- }
40
- else {
41
- out[key] = value;
42
- }
43
- };
44
- (0, objectKeys_1.objectKeys)(obj).forEach((key) => {
45
- let value = obj[key];
46
- // istanbul ignore next
47
- if (value === undefined || value === null) {
48
- return;
49
- }
50
- // istanbul ignore next
51
- if (value === "" && out[key] !== "") {
52
- return;
53
- }
54
- if ((0, isPrimitive_1.isPrimitive)(value) || typeof value === "function") {
55
- set(key, value);
56
- return;
57
- }
58
- if ((0, isArray_1.isArrayOrArrayClass)(value)) {
59
- value = value.map((value) => deepExtends(undefined, value));
60
- set(key, []
61
- .concat(out[key] || [], value)
62
- .reduce((collection, value) => (reducers[key] ? reducers[key](collection, value) : defaultReducer(collection, value)), []));
63
- return;
64
- }
65
- // Object
66
- if ((0, isArray_1.isArrayOrArrayClass)(obj)) {
67
- set(key, deepExtends(undefined, value, reducers));
68
- }
69
- else {
70
- set(key, deepExtends(out[key], value, reducers));
71
- }
72
- });
73
- if ((0, isArray_1.isArrayOrArrayClass)(out)) {
74
- out.reduce((collection, value) => defaultReducer(collection, value), []);
75
- }
76
- return out;
77
- }
78
- exports.deepExtends = deepExtends;
79
- //# sourceMappingURL=deepExtends.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"deepExtends.js","sourceRoot":"","sources":["../../../../src/utils/objects/deepEx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AAW,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;SAClD;IACH,CAAC,CAAC,CAAC;IAEH,IAAI,IAAA,6BAAmB,EAAC,GAAG,CAAC,EAAE;QAC5B,GAAG,CAAC,MAAM,CAAC,CAAC,UAAiB,EAAE,KAAU,EAAE,EAAE,CAAC,cAAc,CAAC,UAAU,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;KACtF;IAED,OAAO,GAAG,CAAC;AACb,CAAC;AAzED,kCAyEC","sourcesContent":["import {createInstance} from \"./createInstance\";\nimport {isArrayOrArrayClass} from \"./isArray\";\nimport {isPrimitive} from \"./isPrimitive\";\nimport {objectKeys} from \"./objectKeys\";\n\nexport type DeepExtendsReducers = Record<string, (collection: any[], value: any) => any>;\n\nfunction reducer() {\n return (collection: any[], value: any) => {\n collection.indexOf(value) === -1 && collection.push(value);\n\n return collection;\n };\n}\n\n/**\n * Deep extends a model with another one.\n * @param out\n * @param obj\n * @param reducers\n * @returns {any}\n * @deprecated Since 2021-07-16. Use deepMerge instead of\n */\nexport function deepExtends(out: any, obj: any, reducers: DeepExtendsReducers = {}): any {\n if (obj === undefined || obj === null) {\n return out;\n }\n\n if (isPrimitive(obj) || typeof obj === \"symbol\" || typeof obj === \"function\") {\n return obj;\n }\n\n if (isArrayOrArrayClass(obj)) {\n out = out || [];\n } else {\n out = out || createInstance(obj);\n }\n\n const defaultReducer = reducers[\"default\"] ? reducers[\"default\"] : reducer();\n\n const set = (key: string | number, value: any) => {\n if (isArrayOrArrayClass(obj)) {\n out.indexOf(value) === -1 && out.push(value);\n } else {\n out[key] = value;\n }\n };\n\n objectKeys(obj).forEach((key) => {\n let value = obj[key];\n\n // istanbul ignore next\n if (value === undefined || value === null) {\n return;\n }\n\n // istanbul ignore next\n if (value === \"\" && out[key] !== \"\") {\n return;\n }\n\n if (isPrimitive(value) || typeof value === \"function\") {\n set(key, value);\n\n return;\n }\n\n if (isArrayOrArrayClass(value)) {\n value = value.map((value: any) => deepExtends(undefined, value));\n\n set(\n key,\n []\n .concat(out[key] || [], value)\n .reduce(\n (collection: any[], value: any) => (reducers[key] ? reducers[key](collection, value) : defaultReducer(collection, value)),\n []\n )\n );\n\n return;\n }\n\n // Object\n if (isArrayOrArrayClass(obj)) {\n set(key, deepExtends(undefined, value, reducers));\n } else {\n set(key, deepExtends(out[key], value, reducers));\n }\n });\n\n if (isArrayOrArrayClass(out)) {\n out.reduce((collection: any[], value: any) => defaultReducer(collection, value), []);\n }\n\n return out;\n}\n"]}
@@ -1,75 +0,0 @@
1
- import { createInstance } from "./createInstance";
2
- import { isArrayOrArrayClass } from "./isArray";
3
- import { isPrimitive } from "./isPrimitive";
4
- import { objectKeys } from "./objectKeys";
5
- function reducer() {
6
- return (collection, value) => {
7
- collection.indexOf(value) === -1 && collection.push(value);
8
- return collection;
9
- };
10
- }
11
- /**
12
- * Deep extends a model with another one.
13
- * @param out
14
- * @param obj
15
- * @param reducers
16
- * @returns {any}
17
- * @deprecated Since 2021-07-16. Use deepMerge instead of
18
- */
19
- export function deepExtends(out, obj, reducers = {}) {
20
- if (obj === undefined || obj === null) {
21
- return out;
22
- }
23
- if (isPrimitive(obj) || typeof obj === "symbol" || typeof obj === "function") {
24
- return obj;
25
- }
26
- if (isArrayOrArrayClass(obj)) {
27
- out = out || [];
28
- }
29
- else {
30
- out = out || createInstance(obj);
31
- }
32
- const defaultReducer = reducers["default"] ? reducers["default"] : reducer();
33
- const set = (key, value) => {
34
- if (isArrayOrArrayClass(obj)) {
35
- out.indexOf(value) === -1 && out.push(value);
36
- }
37
- else {
38
- out[key] = value;
39
- }
40
- };
41
- objectKeys(obj).forEach((key) => {
42
- let value = obj[key];
43
- // istanbul ignore next
44
- if (value === undefined || value === null) {
45
- return;
46
- }
47
- // istanbul ignore next
48
- if (value === "" && out[key] !== "") {
49
- return;
50
- }
51
- if (isPrimitive(value) || typeof value === "function") {
52
- set(key, value);
53
- return;
54
- }
55
- if (isArrayOrArrayClass(value)) {
56
- value = value.map((value) => deepExtends(undefined, value));
57
- set(key, []
58
- .concat(out[key] || [], value)
59
- .reduce((collection, value) => (reducers[key] ? reducers[key](collection, value) : defaultReducer(collection, value)), []));
60
- return;
61
- }
62
- // Object
63
- if (isArrayOrArrayClass(obj)) {
64
- set(key, deepExtends(undefined, value, reducers));
65
- }
66
- else {
67
- set(key, deepExtends(out[key], value, reducers));
68
- }
69
- });
70
- if (isArrayOrArrayClass(out)) {
71
- out.reduce((collection, value) => defaultReducer(collection, value), []);
72
- }
73
- return out;
74
- }
75
- //# sourceMappingURL=deepExtends.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"deepExtends.js","sourceRoot":"","sources":["../../../../src/utils/objects/deepExtends.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAC,mBAAmB,EAAC,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAC;AAIxC,SAAS,OAAO;IACd,OAAO,CAAC,UAAiB,EAAE,KAAU,EAAE,EAAE;QACvC,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAE3D,OAAO,UAAU,CAAC;IACpB,CAAC,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW,CAAC,GAAQ,EAAE,GAAQ,EAAE,WAAgC,EAAE;IAChF,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,IAAI,EAAE;QACrC,OAAO,GAAG,CAAC;KACZ;IAED,IAAI,WAAW,CAAC,GAAG,CAAC,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,OAAO,GAAG,KAAK,UAAU,EAAE;QAC5E,OAAO,GAAG,CAAC;KACZ;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G,CACD,GAAG,EACH,EAAE;iBACC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,KAAK,CAAC;iBAC7B,MAAM,CACL,CAAC,UAAiB,EAAE,KAAU,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,EACzH,EAAE,CACH,CACJ,CAAC;YAEF,OAAO;SACR;QAED,SAAS;QACT,IAAI,mBAAmB,CAAC,GAAG,CAAC,EAAE;YAC5B,GAAG,CAAC,GAAG,EAAE,WAAW,CAAC,SAAS,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;SACnD;aAAM;YACL,GAAG,CAAC,GAAG,EAAE,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;SAClD;IACH,CAAC,CAAC,CAAC;IAEH,IAAI,mBAAmB,CAAC,GAAG,CAAC,EAAE;QAC5B,GAAG,CAAC,MAAM,CAAC,CAAC,UAAiB,EAAE,KAAU,EAAE,EAAE,CAAC,cAAc,CAAC,UAAU,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;KACtF;IAED,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["import {createInstance} from \"./createInstance\";\nimport {isArrayOrArrayClass} from \"./isArray\";\nimport {isPrimitive} from \"./isPrimitive\";\nimport {objectKeys} from \"./objectKeys\";\n\nexport type DeepExtendsReducers = Record<string, (collection: any[], value: any) => any>;\n\nfunction reducer() {\n return (collection: any[], value: any) => {\n collection.indexOf(value) === -1 && collection.push(value);\n\n return collection;\n };\n}\n\n/**\n * Deep extends a model with another one.\n * @param out\n * @param obj\n * @param reducers\n * @returns {any}\n * @deprecated Since 2021-07-16. Use deepMerge instead of\n */\nexport function deepExtends(out: any, obj: any, reducers: DeepExtendsReducers = {}): any {\n if (obj === undefined || obj === null) {\n return out;\n }\n\n if (isPrimitive(obj) || typeof obj === \"symbol\" || typeof obj === \"function\") {\n return obj;\n }\n\n if (isArrayOrArrayClass(obj)) {\n out = out || [];\n } else {\n out = out || createInstance(obj);\n }\n\n const defaultReducer = reducers[\"default\"] ? reducers[\"default\"] : reducer();\n\n const set = (key: string | number, value: any) => {\n if (isArrayOrArrayClass(obj)) {\n out.indexOf(value) === -1 && out.push(value);\n } else {\n out[key] = value;\n }\n };\n\n objectKeys(obj).forEach((key) => {\n let value = obj[key];\n\n // istanbul ignore next\n if (value === undefined || value === null) {\n return;\n }\n\n // istanbul ignore next\n if (value === \"\" && out[key] !== \"\") {\n return;\n }\n\n if (isPrimitive(value) || typeof value === \"function\") {\n set(key, value);\n\n return;\n }\n\n if (isArrayOrArrayClass(value)) {\n value = value.map((value: any) => deepExtends(undefined, value));\n\n set(\n key,\n []\n .concat(out[key] || [], value)\n .reduce(\n (collection: any[], value: any) => (reducers[key] ? reducers[key](collection, value) : defaultReducer(collection, value)),\n []\n )\n );\n\n return;\n }\n\n // Object\n if (isArrayOrArrayClass(obj)) {\n set(key, deepExtends(undefined, value, reducers));\n } else {\n set(key, deepExtends(out[key], value, reducers));\n }\n });\n\n if (isArrayOrArrayClass(out)) {\n out.reduce((collection: any[], value: any) => defaultReducer(collection, value), []);\n }\n\n return out;\n}\n"]}
@@ -1,10 +0,0 @@
1
- export declare type DeepExtendsReducers = Record<string, (collection: any[], value: any) => any>;
2
- /**
3
- * Deep extends a model with another one.
4
- * @param out
5
- * @param obj
6
- * @param reducers
7
- * @returns {any}
8
- * @deprecated Since 2021-07-16. Use deepMerge instead of
9
- */
10
- export declare function deepExtends(out: any, obj: any, reducers?: DeepExtendsReducers): any;