picker
Pick property in json data by string path key
Last updated 11 years ago by ragingwind .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install picker 
SYNC missed versions from official npm registry.

picker Build Status

Pick property in json data by string path key

Install

$ npm install --save picker

Usage

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]);

API

picker(jsonData, path)

input

Required
Type: json

Target json data contains name and value to pick

path

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

Returns

If picker can find a target then will returns its parent, key and value of object or not picker returns null.

License

MIT © ragingwind

Current Tags

  • 0.1.4                                ...           latest (11 years ago)

5 Versions

  • 0.1.4                                ...           11 years ago
  • 0.1.3                                ...           11 years ago
  • 0.1.2                                ...           11 years ago
  • 0.1.1                                ...           11 years ago
  • 0.1.0                                ...           11 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 1
Last Month 0
Dependencies (0)
None
Dev Dependencies (1)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |