inner
v0.2.0
Published
Get and set values in deeply nested objects.
Downloads
98
Readme
Inner
Get and set values in deeply nested objects.
Installation
npm install inner
Usage
var inner = require('inner');
var object = {
user: {
name: 'John',
friends: ['Mike', 'Alex']
}
};
inner.get(object, ['user', 'friends', '0']); // -> 'Mike'
inner.set(object, ['user', 'name'], 'Chris'); // object.user.name == 'Chris'
inner.has(object, ['user', 'friends', '1']); // -> true
Credits
Inner is just like this library, but with support for specifying nested properties as arrays instead of strings.