https://github.com/yamadapc/node-unwind
Generate objects based on a (possibly nested) path and a value.
https://github.com/yamadapc/node-unwind
Last synced: 3 months ago
JSON representation
Generate objects based on a (possibly nested) path and a value.
- Host: GitHub
- URL: https://github.com/yamadapc/node-unwind
- Owner: yamadapc
- License: mit
- Created: 2014-06-12T01:06:07.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2016-02-12T13:46:34.000Z (over 9 years ago)
- Last Synced: 2025-01-26T02:04:29.462Z (4 months ago)
- Language: JavaScript
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
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:
```javascript
unwind('something.nested', 10)
// => { something: { nested: 10 } }
unwind('something', 'else')
// => { something: 'else' }
```## Donations
Would you like to buy me a beer? Send bitcoin to 3JjxJydvoJjTrhLL86LGMc8cNB16pTAF3y