$ cnpm install picker
Pick property in json data by string path key
$ npm install --save picker
var picker = require('picker');
var prop = picker(json, 'json.properties.object.name');
console.log(prop.value, prop.key, prop.container);
var prop = picker(json, 'json.properties.array.[0]');
console.log(prop.container[0]);
Required
Type: json
Target json data contains name and value to pick
Required
Type: string
Path to get to target property. Using string index to get a path to Array type property. You can find more information in the test.js
If picker can find a target then will returns its parent, key and value of object or not picker returns null.
MIT © ragingwind
Copyright 2013 - present © cnpmjs.org | Home |