JPath

0.2.0 • Public • Published

JPath is a tool for riding through json using an XPath syntax.

Install for Node.js

npm install JPath

Travis CI tracker: http://travis-ci.org/j-san/JPath Build Status

Usage

JPath improve Array method set, you just need to add elements in arrays to start using JPath.

Array.query([path]) or Array.q([path])

Return a subset of the array containig each matching elements.

Array.count([path])

Return the number of matching elements by path.

Array.sum([path])

Return the sum of matched values.

Array.exists([path])

Return true if any element match the path.

Array.valueOf([path])

Return a string containig each literal values of the array.

Array.copyOf([path])

Return a string representation of the array.

Supported XPath syntax

path/to/somewhere
path//deep//inside/and/*/all/children
with[contains/path]/and/index[123]/selection
computing[(1+2)*123=5]
/any[combining]/of//different/*[0]/syntax
...

Supported XPath operators

/ child // descendant % modulo / divide

  • multiply
  • add
  • substract | union = equal and and or or

Todo

  • use forEach and hasOwnProperty in loops
  • use grunk
  • function support

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.2.0
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.2.0
    1
  • 0.1.1
    0
  • 0.1.0
    0

Package Sidebar

Install

npm i JPath

Weekly Downloads

1

Version

0.2.0

License

none

Last publish

Collaborators

  • jsan