expand-top-level-dot-paths
Expand top-level object properties that are dot-paths
Install
npm install --save expand-top-level-dot-paths
yarn add expand-top-level-dot-paths
Import
// ES2015
// CommonJSvar expand = require
Usage
expand(obj[, initialValue]) : Object
Expand top-level object properties that are dot-paths. If no initialValue
given the initial value is a clone of the object. In this case all original dot-path
properties are removed from the clone.
- obj {Object} (required) The object to expand
- initialValue {Object} (optional) Value to place expanded properties on (default: clone of
obj
)
Returns initialValue
with all top-level dot-path properties from obj
expanded on it.
Example
const obj = 'expand.me': 'please' const expanded = //=> {// expand: {// me: 'please'// }// } obj === expanded //=> false
Contributing
All pull requests and issues welcome!
If you're not sure how, check out the great video tutorials on egghead.io!
License
MIT © Sam Gluck