bubble-gum-create
Creates a new object or an initialized array depending on the input path
bubble-gum-create
is part of bubble-gum-tools, check this here
Install
You can install bubble-gum-create using npm.
npm install --save bubble-gum-create
API Reference
bubble-gum-create
Object
| Array
⏏
module.exports(path, initValue) ⇒ It creates a new object or an initialized array depending on the input path
Kind: Exported function
Returns: Object
| Array
- output - The new array or new object with the input path structure
Param | Type | Description |
---|---|---|
path | Array |
Input path with the structure |
initValue | * |
Initial value for the end of the input path structure |
Example
const create = ; // create nested arrays const nestedArray = ; console; // => [ [ , , [ 'bar' ] ] ] // create nested objects const nestedObject = ; console; // => { root: { foo: { bar: 'bar' } } } // no defined value const noDefaultVal = ; console; // => undefined // create both const mixed = ; console; // => [ { nested: { key: 'value' } } ]
License
MIT @ Nicolas Quiceno