npm.io
0.0.1 • Published 12 years ago

unwind

Licence
MIT
Version
0.0.1
Deps
0
Vulns
0
Weekly
0

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' }

Keywords