@aofl/object-utils
Advanced tools
Comparing version 1.0.0-beta.26 to 1.0.0-beta.27
37
index.js
@@ -1,35 +0,2 @@ | ||
export const deepFreeze = (o) => { | ||
Object.freeze(o); | ||
Object.getOwnPropertyNames(o).forEach((prop) => { | ||
if (o.hasOwnProperty(prop) && o[prop] !== null && | ||
(typeof o[prop] === 'object' || typeof o[prop] === 'function') && | ||
!Object.isFrozen(o[prop])) { | ||
deepFreeze(o[prop]); | ||
} | ||
}); | ||
return o; | ||
}; | ||
export const deepAssign = (obj, path, payload) => { | ||
let pathParts = path.split('.'); | ||
if (path === '') { | ||
pathParts = []; | ||
} | ||
let recursiveAssign = (pathParts, obj) => { | ||
if (pathParts.length === 0) { | ||
return Object.assign({}, obj, payload); | ||
} | ||
let key = pathParts[0]; | ||
let subPath = pathParts.splice(1); | ||
return Object.assign({}, obj, { | ||
[key]: recursiveAssign(subPath, obj[key]) | ||
}); | ||
}; | ||
return recursiveAssign(pathParts, obj); | ||
}; | ||
export {deepAssign} from './src/deep-assign-service'; | ||
export {deepFreeze} from './src/deep-feeze-service'; |
{ | ||
"name": "@aofl/object-utils", | ||
"version": "1.0.0-beta.26", | ||
"version": "1.0.0-beta.27", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
413810
97
2711
1
113
1