unwind
v0.0.1
Published
Generate objects based on a (possibly nested) path and a value.
Downloads
3
Maintainers
Readme
unwind
Generate objects based on a (possibly nested) path and a value.
unwind(path, value)
Generates a simple object based on a (possibly nested) path, and the value associated with it.
Params:
- String path A path, or nested path - a representation of nested keys
- Mixed value The value to set to this path
Return:
- Object The generated object
Example:
unwind('something.nested', 10)
// => { something: { nested: 10 } }
unwind('something', 'else')
// => { something: 'else' }