set-deep
v0.1.1
Published
Helper for setting the value of a nested object property
Downloads
7
Maintainers
Readme
set-deep
Helper for setting the value of a nested object property
Install
$ npm install set-deep
Usage
var set = require('set-deep')
var target = {
person: {
address: {
country: ''
}
}
}
set('person.address.country', target, 'France')
//or
set(['person', 'address', 'country'], target, 'France')
//or
var setCountry = set('person.address.country')
setCountry(target, 'France')
//or
var setCountryOnTarget = set('person.address.country', target)
setCountryOnTarget('UK')
Tests
$ make
License
MIT