ts-deepmerge
Advanced tools
Comparing version 6.1.0 to 6.2.0
@@ -23,2 +23,9 @@ type TAllKeys<T> = T extends any ? keyof T : never; | ||
/** | ||
* When `true`, values explicitly provided as `undefined` will override existing values, though properties that are simply omitted won't affect anything. | ||
* When `false`, values explicitly provided as `undefined` won't override existing values. | ||
* | ||
* Default: `true` | ||
*/ | ||
allowUndefinedOverrides: boolean; | ||
/** | ||
* When `true` it will merge array properties. | ||
@@ -25,0 +32,0 @@ * When `false` it will replace array properties with the last instance entirely instead of merging their contents. |
@@ -33,3 +33,8 @@ "use strict"; | ||
else { | ||
result[key] = current[key]; | ||
result[key] = | ||
current[key] === undefined | ||
? merge.options.allowUndefinedOverrides | ||
? current[key] | ||
: result[key] | ||
: current[key]; | ||
} | ||
@@ -40,2 +45,3 @@ }); | ||
const defaultOptions = { | ||
allowUndefinedOverrides: true, | ||
mergeArrays: true, | ||
@@ -42,0 +48,0 @@ uniqueArrayItems: true, |
@@ -23,2 +23,9 @@ type TAllKeys<T> = T extends any ? keyof T : never; | ||
/** | ||
* When `true`, values explicitly provided as `undefined` will override existing values, though properties that are simply omitted won't affect anything. | ||
* When `false`, values explicitly provided as `undefined` won't override existing values. | ||
* | ||
* Default: `true` | ||
*/ | ||
allowUndefinedOverrides: boolean; | ||
/** | ||
* When `true` it will merge array properties. | ||
@@ -25,0 +32,0 @@ * When `false` it will replace array properties with the last instance entirely instead of merging their contents. |
@@ -31,3 +31,8 @@ // istanbul ignore next | ||
else { | ||
result[key] = current[key]; | ||
result[key] = | ||
current[key] === undefined | ||
? merge.options.allowUndefinedOverrides | ||
? current[key] | ||
: result[key] | ||
: current[key]; | ||
} | ||
@@ -38,2 +43,3 @@ }); | ||
const defaultOptions = { | ||
allowUndefinedOverrides: true, | ||
mergeArrays: true, | ||
@@ -40,0 +46,0 @@ uniqueArrayItems: true, |
@@ -5,3 +5,3 @@ { | ||
"license": "ISC", | ||
"version": "6.1.0", | ||
"version": "6.2.0", | ||
"scripts": { | ||
@@ -59,17 +59,17 @@ "clean": "rimraf ./{cjs,esm}/!(package.json)", | ||
"devDependencies": { | ||
"@types/jest": "^29.5.2", | ||
"@typescript-eslint/eslint-plugin": "^5.60.0", | ||
"@types/jest": "^29.5.3", | ||
"@typescript-eslint/eslint-plugin": "^6.1.0", | ||
"concurrently": "^8.2.0", | ||
"cross-env": "^7.0.3", | ||
"eslint": "^8.43.0", | ||
"eslint-config-voodoocreation": "^3.0.2", | ||
"eslint": "^8.45.0", | ||
"eslint-config-voodoocreation": "^4.0.0", | ||
"eslint-plugin-import": "^2.27.5", | ||
"eslint-plugin-jest": "^27.2.2", | ||
"eslint-plugin-jest": "^27.2.3", | ||
"eslint-plugin-prefer-arrow": "^1.2.3", | ||
"jest": "^29.5.0", | ||
"jest-environment-jsdom": "^29.5.0", | ||
"prettier": "^2.8.8", | ||
"ts-jest": "^29.1.0", | ||
"typescript": "^5.1.3" | ||
"jest": "^29.6.1", | ||
"jest-environment-jsdom": "^29.6.1", | ||
"prettier": "^3.0.0", | ||
"ts-jest": "^29.1.1", | ||
"typescript": "^5.1.6" | ||
} | ||
} |
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
11025
196