object-assign-deep
Advanced tools
Comparing version 0.3.1 to 0.4.0
module.exports = { | ||
"extends": "eslint-config-recombix", | ||
"rules": { | ||
"quotes": [2, "single"] | ||
}, | ||
}; |
@@ -14,11 +14,11 @@ 'use strict'; | ||
if (input === null) { | ||
return `null`; | ||
return 'null'; | ||
} | ||
else if (typeof input === `undefined`) { | ||
return `undefined`; | ||
else if (typeof input === 'undefined') { | ||
return 'undefined'; | ||
} | ||
else if (typeof input === `object`) { | ||
return (Array.isArray(input) ? `array` : `object`); | ||
else if (typeof input === 'object') { | ||
return (Array.isArray(input) ? 'array' : 'object'); | ||
} | ||
@@ -36,3 +36,3 @@ | ||
// The value is an object so lets clone it. | ||
if (getTypeOf(value) === `object`) { | ||
if (getTypeOf(value) === 'object') { | ||
return quickCloneObject(value); | ||
@@ -42,3 +42,3 @@ } | ||
// The value is an array so lets clone it. | ||
else if (getTypeOf(value) === `array`) { | ||
else if (getTypeOf(value) === 'array') { | ||
return quickCloneArray(value); | ||
@@ -83,3 +83,3 @@ } | ||
const options = { | ||
arrayBehaviour: _options.arrayBehaviour || `replace`, // Can be "merge" or "replace". | ||
arrayBehaviour: _options.arrayBehaviour || 'replace', // Can be "merge" or "replace". | ||
}; | ||
@@ -89,3 +89,2 @@ | ||
const objects = _objects.map(object => object || {}); | ||
const output = target || {}; | ||
@@ -104,5 +103,5 @@ | ||
if (type === `object`) { | ||
if (existingValueType !== `undefined`) { | ||
const existingValue = (existingValueType === `object` ? output[key] : {}); | ||
if (type === 'object') { | ||
if (existingValueType !== 'undefined') { | ||
const existingValue = (existingValueType === 'object' ? output[key] : {}); | ||
output[key] = executeDeepMerge({}, [existingValue, quickCloneObject(value)], options); | ||
@@ -115,6 +114,6 @@ } | ||
else if (type === `array`) { | ||
if (existingValueType === `array`) { | ||
else if (type === 'array') { | ||
if (existingValueType === 'array') { | ||
const newValue = quickCloneArray(value); | ||
output[key] = (options.arrayBehaviour === `merge` ? output[key].concat(newValue) : newValue); | ||
output[key] = (options.arrayBehaviour === 'merge' ? output[key].concat(newValue) : newValue); | ||
} | ||
@@ -130,3 +129,2 @@ else { | ||
} | ||
@@ -133,0 +131,0 @@ } |
@@ -10,3 +10,3 @@ { | ||
"name": "object-assign-deep", | ||
"version": "0.3.1", | ||
"version": "0.4.0", | ||
"description": "Allows deep cloning of plain objects that contain primitives, nested plain objects, or nested plain arrays.", | ||
@@ -36,6 +36,10 @@ "keywords": [ | ||
"eslint-config-recombix": "latest", | ||
"eslint-config-vue": "latest", | ||
"eslint-plugin-disable": "latest", | ||
"eslint-plugin-filenames": "latest", | ||
"eslint-plugin-html": "latest", | ||
"eslint-plugin-json": "latest", | ||
"eslint-plugin-node": "^4.2.1", | ||
"eslint-plugin-promise": "latest" | ||
"eslint-plugin-node": "latest", | ||
"eslint-plugin-promise": "latest", | ||
"eslint-plugin-vue": "latest" | ||
}, | ||
@@ -42,0 +46,0 @@ "license": "MIT", |
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
293
12994
10
9