@webundsoehne/deep-merge
Advanced tools
Comparing version 2.2.6 to 3.0.0
export { deepMerge, deepMergeWithArrayOverwrite, deepMergeWithUniqueMergeArray, uniqueArrayFilter } from './merge.js'; | ||
import '@webundsoehne/ts-utility-types'; |
@@ -0,1 +1,3 @@ | ||
import { DeepPartial } from '@webundsoehne/ts-utility-types'; | ||
/** | ||
@@ -5,6 +7,4 @@ * Merge objects with defaults. | ||
* Mutates the object. | ||
* @param t | ||
* @param s | ||
*/ | ||
declare function deepMerge<T extends Record<string, any>>(t: T, ...s: Partial<T>[]): T; | ||
declare function deepMerge<T extends Record<PropertyKey, any>>(t: T, ...s: DeepPartial<T>[]): T; | ||
/** | ||
@@ -14,6 +14,4 @@ * Merge objects with array merge and filtering them uniquely. | ||
* Mutates the object. | ||
* @param t | ||
* @param s | ||
*/ | ||
declare function deepMergeWithUniqueMergeArray<T extends Record<string, any>>(t: T, ...s: Partial<T>[]): T; | ||
declare function deepMergeWithUniqueMergeArray<T extends Record<PropertyKey, any>>(t: T, ...s: DeepPartial<T>[]): T; | ||
/** | ||
@@ -23,6 +21,4 @@ * Merge objects with overwriting the target array with source array. | ||
* Mutates the object. | ||
* @param t | ||
* @param s | ||
*/ | ||
declare function deepMergeWithArrayOverwrite<T extends Record<string, any>>(t: T, ...s: Partial<T>[]): T; | ||
declare function deepMergeWithArrayOverwrite<T extends Record<PropertyKey, any>>(t: T, ...s: DeepPartial<T>[]): T; | ||
/** | ||
@@ -29,0 +25,0 @@ * A standard array filter for filtering it to unique items. |
@@ -35,10 +35,10 @@ var __create = Object.create; | ||
function deepMerge(t, ...s) { | ||
return s.reduce((o, val) => { | ||
return (0, import_deepmerge.default)(o, val ?? {}); | ||
}, t); | ||
return deepMergeWithUniqueMergeArray(t, ...s); | ||
} | ||
__name(deepMerge, "deepMerge"); | ||
function deepMergeWithUniqueMergeArray(t, ...s) { | ||
return s.reduce((o, val) => { | ||
return (0, import_deepmerge.default)(o, val ?? {}, { | ||
return import_deepmerge.default.all([ | ||
t, | ||
...s ?? [], | ||
{ | ||
arrayMerge: (target, source) => [ | ||
@@ -48,12 +48,14 @@ ...target, | ||
].filter(uniqueArrayFilter) | ||
}); | ||
}, t); | ||
} | ||
]); | ||
} | ||
__name(deepMergeWithUniqueMergeArray, "deepMergeWithUniqueMergeArray"); | ||
function deepMergeWithArrayOverwrite(t, ...s) { | ||
return s.reduce((o, val) => { | ||
return (0, import_deepmerge.default)(o, val ?? {}, { | ||
return import_deepmerge.default.all([ | ||
t, | ||
...s ?? [], | ||
{ | ||
arrayMerge: (_, source) => source | ||
}); | ||
}, t); | ||
} | ||
]); | ||
} | ||
@@ -60,0 +62,0 @@ __name(deepMergeWithArrayOverwrite, "deepMergeWithArrayOverwrite"); |
{ | ||
"name": "@webundsoehne/deep-merge", | ||
"description": "Generic object deepmerge.", | ||
"version": "2.2.6", | ||
"version": "3.0.0", | ||
"author": "Backend <backend@webundsoehne.com>", | ||
@@ -6,0 +6,0 @@ "repository": "https://github.com/tailoredmedia/backend-nx-skeleton", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7501
111