knife-json
v1.0.2
Published
Get value of object easily use path
Downloads
4
Readme
knife-json
Get value of object easily use path
NOTE: not supprt the array current
API
- knife(object, path) => Get the value of the path
- knife.paths(object) => get the paths of the object
- knife.contain(object, path) => check the paths of the object
var knife = require('knife-json');
var testdata = {
root: 'root',
name: 'yt',
nested: {
nested1: {
nested2: "nested3"
}
}
};
console.log(knife(testdata, 'nested.nested1.nested2')) // nested3
console.log(knife.paths(testdata)) // [ 'root', 'name', 'nested.nested1.nested2' ]
console.log(knife.contain(testdata, 'nested.nested1.nested2')) //true