Comparing version 0.1.2 to 0.1.3
@@ -37,4 +37,9 @@ var aesprim = require('./aesprim'); | ||
'member-child-identifier': | ||
_descend(function(key, value, ref) { return key == ref }), | ||
'member-child-identifier': function(component, partial) { | ||
var key = component.expression.value; | ||
var value = partial.value; | ||
if (value instanceof Object && key in value) { | ||
return [ { value: value[key], path: partial.path.concat(key) } ] | ||
} | ||
}, | ||
@@ -41,0 +46,0 @@ 'member-descendant-identifier': |
@@ -180,3 +180,3 @@ var assert = require('assert'); | ||
if (typeof component == "string" && component.match(dict.identifier)) { | ||
if (typeof component == "string" && component.match("^" + dict.identifier + "$")) { | ||
@@ -183,0 +183,0 @@ _path.push({ |
{ | ||
"name": "jsonpath", | ||
"description": "Query JavaScript objects with JSONPath expressions. Robust / safe JSONPath engine for Node.js.", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"author": "david@fmail.co.uk", | ||
@@ -24,3 +24,13 @@ "scripts": { | ||
}, | ||
"keywords": [ | ||
"JSONPath", | ||
"jsonpath", | ||
"json-path", | ||
"object", | ||
"traversal", | ||
"json", | ||
"path", | ||
"data structures" | ||
], | ||
"license": "MIT" | ||
} |
@@ -24,2 +24,9 @@ [![Build Status](https://travis-ci.org/dchester/jsonpath.png?branch=master)](https://travis-ci.org/dchester/jsonpath) | ||
## Install | ||
Install from npm: | ||
```bash | ||
$ npm install jsonpath | ||
``` | ||
## JSONPath Syntax | ||
@@ -26,0 +33,0 @@ |
@@ -31,2 +31,7 @@ var assert = require('assert'); | ||
test('keys with hyphens get subscripted', function() { | ||
var string = jp.stringify(['$', 'member-search']); | ||
assert.equal(string, '$["member-search"]'); | ||
}); | ||
test('complicated path round trips', function() { | ||
@@ -33,0 +38,0 @@ var pathExpression = '$..*[0:2].member["string-xyz"]'; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
51693
978
214