Does this ever happen to you?
> cars = {}
{}
> cars.mercedes.sl600.color = 'blue'
TypeError: Cannot read property 'sl600' of undefined
Well now there's node-autovivify!
> Av = require('autovivify')
> cars = new Av()
{}
> cars.mercedes.sl600.color = 'blue'
'blue'
It also works with arrays!
Av = require('autovivify')
> cars = new Av()
> cars.mercedes.sl600.color = 'blue'
'blue'
> cars.carlist[0] = cars.mercedes
{ sl600: { color: 'blue' } }npm install autovivify
const Av = require('autovivify')
const obj = new Av()
obj.subobj[4].subarray[2].myvalue = 'coolio'
assert(obj.subobj[4].subarray[2].myvalue === 'coolio')Symbols are not supported as properties.
You cannot use undefined checks with this structure as the very act of checking ensures that the structure is defined. Use membership or length checks to determine if something is empty.
To make a new binary release:
- Edit package.json. Increment the 
versionproperty. node-pre-gyp rebuildnode-pre-gyp packagenode-pre-gyp-github publishnpm publish
You will need a NODE_PRE_GYP_GITHUB_TOKEN with repo:status,
repo_deployment and public_repo access to the target repo. You'll
also need write access to the npm repo.