object-path-immutable
Advanced tools
Comparing version 4.1.0 to 4.1.1
{ | ||
"name": "object-path-immutable", | ||
"version": "4.1.0", | ||
"version": "4.1.1", | ||
"description": "Modify deep object properties without modifying the original object (immutability). Works great with React and Redux.", | ||
@@ -30,14 +30,14 @@ "author": "Mario Casciaro <m@mario.fyi>", | ||
"is-plain-object": "^3.0.0", | ||
"object-path": "^0.11.4" | ||
"object-path": "^0.11.5" | ||
}, | ||
"devDependencies": { | ||
"chai": "^4.2.0", | ||
"coveralls": "^3.0.9", | ||
"nyc": "^15.0.0", | ||
"mocha": "^7.0.1", | ||
"coveralls": "^3.1.0", | ||
"nyc": "^15.1.0", | ||
"mocha": "^8.2.0", | ||
"mocha-lcov-reporter": "^1.3.0", | ||
"rollup": "^1.30.1", | ||
"rollup": "^1.32.1", | ||
"rollup-plugin-commonjs": "^10.1.0", | ||
"rollup-plugin-node-resolve": "^5.2.0", | ||
"standard": "^14.3.1" | ||
"standard": "^14.3.4" | ||
}, | ||
@@ -44,0 +44,0 @@ "keywords": [ |
@@ -136,4 +136,11 @@ (function (global, factory) { | ||
function hasShallowProperty(obj, prop) { | ||
return (options.includeInheritedProps || (typeof prop === 'number' && Array.isArray(obj)) || hasOwnProperty(obj, prop)) | ||
var hasShallowProperty; | ||
if (options.includeInheritedProps) { | ||
hasShallowProperty = function () { | ||
return true | ||
}; | ||
} else { | ||
hasShallowProperty = function (obj, prop) { | ||
return (typeof prop === 'number' && Array.isArray(obj)) || hasOwnProperty(obj, prop) | ||
}; | ||
} | ||
@@ -159,2 +166,6 @@ | ||
var currentValue = getShallowProperty(obj, currentPath); | ||
if (options.includeInheritedProps && (currentPath === '__proto__' || | ||
(currentPath === 'constructor' && typeof currentValue === 'function'))) { | ||
throw new Error('For security reasons, object\'s magic properties cannot be set') | ||
} | ||
if (path.length === 1) { | ||
@@ -161,0 +172,0 @@ if (currentValue === void 0 || !doNotReplace) { |
Sorry, the diff of this file is not supported yet
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
63941
1919
Updatedobject-path@^0.11.5