get/set observify values using dot-notation keypaths
npm install --save observify-keypath
var keypath = require('observify-keypath');
var data = observify({
nested: {
obj: {
arr: [{ cool: 'pizza' }]
}
}
});
// get a value
var value = keypath.get(data, 'nested.obj.arr.0.cool');
// set a value
keypath.set(data, 'nested.obj.arr.0.cool', 'awesome');
data
is the observify object.
keypath
is the path of keys specified using dot notation.
data
is that observify object.
keypath
is the path of keys specified using dot notation.
value
is what you will set the value to.
MIT