Comparing version 0.2.4 to 0.2.5
@@ -38,3 +38,6 @@ /* global toString */ | ||
var nodes = this.nodes(obj, string); | ||
var nodes = this.nodes(obj, string).sort(function(a, b) { | ||
// sort nodes so we apply from the bottom up | ||
return b.path.length - a.path.length; | ||
}); | ||
@@ -41,0 +44,0 @@ nodes.forEach(function(node) { |
{ | ||
"name": "jsonpath", | ||
"description": "Query JavaScript objects with JSONPath expressions. Robust / safe JSONPath engine for Node.js.", | ||
"version": "0.2.4", | ||
"version": "0.2.5", | ||
"author": "david@fmail.co.uk", | ||
@@ -6,0 +6,0 @@ "scripts": { |
@@ -20,2 +20,10 @@ var assert = require('assert'); | ||
test('apply method applies survives structural changes', function() { | ||
var data = {a: {b: [1, {c: [2,3]}]}}; | ||
jp.apply(data, '$..*[?(@.length > 1)]', function(array) { | ||
return array.reverse(); | ||
}); | ||
assert.deepEqual(data.a.b, [{c: [3, 2]}, 1]); | ||
}); | ||
test('value method gets us a value', function() { | ||
@@ -22,0 +30,0 @@ var data = { a: 1, b: 2, c: 3, z: { a: 100, b: 200 } }; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
387651
7731