ts-deepmerge
Advanced tools
Comparing version 6.2.1 to 7.0.0
@@ -16,3 +16,3 @@ type TAllKeys<T> = T extends any ? keyof T : never; | ||
} | ||
declare const merge: { | ||
export declare const merge: { | ||
<T extends IObject[]>(...objects: T): TMerged<T[number]>; | ||
@@ -45,2 +45,2 @@ options: IOptions; | ||
} | ||
export default merge; | ||
export {}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.merge = void 0; | ||
// istanbul ignore next | ||
@@ -23,4 +24,4 @@ const isObject = (obj) => { | ||
if (Array.isArray(result[key]) && Array.isArray(current[key])) { | ||
result[key] = merge.options.mergeArrays | ||
? merge.options.uniqueArrayItems | ||
result[key] = exports.merge.options.mergeArrays | ||
? exports.merge.options.uniqueArrayItems | ||
? Array.from(new Set(result[key].concat(current[key]))) | ||
@@ -31,3 +32,3 @@ : [...result[key], ...current[key]] | ||
else if (isObject(result[key]) && isObject(current[key])) { | ||
result[key] = merge(result[key], current[key]); | ||
result[key] = (0, exports.merge)(result[key], current[key]); | ||
} | ||
@@ -37,3 +38,3 @@ else { | ||
current[key] === undefined | ||
? merge.options.allowUndefinedOverrides | ||
? exports.merge.options.allowUndefinedOverrides | ||
? current[key] | ||
@@ -46,2 +47,3 @@ : result[key] | ||
}, {}); | ||
exports.merge = merge; | ||
const defaultOptions = { | ||
@@ -52,9 +54,8 @@ allowUndefinedOverrides: true, | ||
}; | ||
merge.options = defaultOptions; | ||
merge.withOptions = (options, ...objects) => { | ||
merge.options = Object.assign(Object.assign({}, defaultOptions), options); | ||
const result = merge(...objects); | ||
merge.options = defaultOptions; | ||
exports.merge.options = defaultOptions; | ||
exports.merge.withOptions = (options, ...objects) => { | ||
exports.merge.options = Object.assign(Object.assign({}, defaultOptions), options); | ||
const result = (0, exports.merge)(...objects); | ||
exports.merge.options = defaultOptions; | ||
return result; | ||
}; | ||
exports.default = merge; |
@@ -16,3 +16,3 @@ type TAllKeys<T> = T extends any ? keyof T : never; | ||
} | ||
declare const merge: { | ||
export declare const merge: { | ||
<T extends IObject[]>(...objects: T): TMerged<T[number]>; | ||
@@ -45,2 +45,2 @@ options: IOptions; | ||
} | ||
export default merge; | ||
export {}; |
@@ -12,3 +12,3 @@ // istanbul ignore next | ||
}; | ||
const merge = (...objects) => objects.reduce((result, current) => { | ||
export const merge = (...objects) => objects.reduce((result, current) => { | ||
if (Array.isArray(current)) { | ||
@@ -54,2 +54,1 @@ throw new TypeError("Arguments provided to ts-deepmerge must be objects, not arrays."); | ||
}; | ||
export default merge; |
@@ -5,3 +5,3 @@ { | ||
"license": "ISC", | ||
"version": "6.2.1", | ||
"version": "7.0.0", | ||
"scripts": { | ||
@@ -64,3 +64,3 @@ "clean": "rimraf ./{cjs,esm}/!(package.json)", | ||
"eslint": "^8.56.0", | ||
"eslint-config-voodoocreation": "^4.0.0", | ||
"eslint-config-voodoocreation": "^5.0.0", | ||
"eslint-plugin-import": "^2.29.1", | ||
@@ -67,0 +67,0 @@ "eslint-plugin-jest": "^27.6.3", |
@@ -19,3 +19,3 @@ [![npm](https://img.shields.io/npm/v/ts-deepmerge)](https://www.npmjs.com/package/ts-deepmerge) | ||
```typescript jsx | ||
import merge from "ts-deepmerge"; | ||
import { merge } from "ts-deepmerge"; | ||
@@ -69,3 +69,3 @@ const obj1 = { | ||
```typescript | ||
import merge from "ts-deepmerge"; | ||
import { merge } from "ts-deepmerge"; | ||
@@ -72,0 +72,0 @@ const obj1 = { |
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
12293