setp
v1.0.2
Published
set a property, creating parent objects as needed
Downloads
3,209
Readme
var setp = require('setp')
var assert = require('assert')
var firstExample = {}
setp(firstExample, ['a', 'b', 'c'], 'value')
assert.deepEqual(firstExample, {a: {b: {c: 'value'}}})
assert.throws(function() {
setp({ a: 'string' }, ['a', 'b', 'c'], 'value')
})