Comparing version 0.2.7 to 0.2.8
@@ -68,3 +68,3 @@ var aesprim = require('./aesprim'); | ||
if (is_array(partial.value)) { | ||
var args = component.expression.value.split(':'); | ||
var args = component.expression.value.split(':').map(_parse_nullable_int); | ||
var values = partial.value.map(function(v, i) { return { value: v, path: partial.path.concat(i) } }); | ||
@@ -253,2 +253,7 @@ return slice.apply(null, [values].concat(args)); | ||
function _parse_nullable_int(val) { | ||
var sval = String(val); | ||
return sval.match(/^-?[0-9]+$/) ? parseInt(sval) : null; | ||
} | ||
module.exports = Handlers; |
module.exports = function(arr, start, end, step) { | ||
if (typeof start == 'string') throw new Error("start cannot be a string"); | ||
if (typeof end == 'string') throw new Error("end cannot be a string"); | ||
if (typeof step == 'string') throw new Error("step cannot be a string"); | ||
var len = arr.length; | ||
@@ -4,0 +8,0 @@ |
{ | ||
"name": "jsonpath", | ||
"description": "Query JavaScript objects with JSONPath expressions. Robust / safe JSONPath engine for Node.js.", | ||
"version": "0.2.7", | ||
"version": "0.2.8", | ||
"author": "david@fmail.co.uk", | ||
@@ -6,0 +6,0 @@ "scripts": { |
@@ -32,3 +32,8 @@ var assert = require('assert'); | ||
test('negative slices', function() { | ||
var results = jp.query(data, "$..book[-1:].title"); | ||
assert.deepEqual(results, ['The Lord of the Rings']); | ||
}); | ||
}); | ||
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
389937
7747