Releases: jg-rp/json-p3
Releases · jg-rp/json-p3
Version 0.3.1
Breaking Changes
- Changed the error thrown due to non-singular queries in comparison expressions from
JSONPathSyntaxError
toJSONPathTypeError
.
Fixes
- Fixed handling of relative and root queries when used as arguments to filter functions. Previously, when those queries resulted in an empty node list, we were converting it to an empty array before passing it to functions that accept ValueType arguments. Now, in such cases, we convert empty node lists to the special result Nothing, which is required by the spec.
- Fixed well-typedness checks on JSONPath logical expressions (those that involve
&&
or||
) and non-singular filter queries. Previously we were erroneously applying the checks for comparison expressions to logical expressions too. Now non-singular queries in logical expressions act as an existence test.
Version 0.3.0
Fixes
- Fixed call stack size issues when querying large datasets with the recursive descent selector. This was mostly due to extending arrays using the spread operator. We now iterate and use
Array.push()
.
Features
- Added
jsonpath.lazyQuery()
, a lazy alternative tojsonpath.query()
.lazyQuery()
can be faster and more memory efficient if querying large datasets, especially when using recursive descent selectors. Conversely,query()
is usually the better choice when working with small datasets. jsonpath.match()
now useslazyQuery()
internally, potentially avoiding a lot of unnecessary work.
Version 0.2.1
Fixes
- Fixed JSONPath filter operator precedence. Previously logical and (
&&
) and or (||
) were binding more tightly than logical negation (!
).
Version 0.2.0
Breaking Changes
- Rename
JSONPathEnvironment.filterRegister
toJSONPathEnvironment.functionRegister
. - Removed
JSONPathEnvironment.options
in favour of equivalent environment properties. For example,JSONPathEnvironment.options.maxIntIndex
is nowJSONPathEnvironment.maxIntIndex
.
Fixes
- Fixed well-typedness checks on function calls. Previously we were throwing a
JSONPathTypError
for some valid queries. - Fixed parsing of function calls with comparison expressions as arguments.
- Fixed a bug with unbalanced parentheses detection in JSONPath expressions when parsing nested function calls. In some cases we were not throwing a
JSONPathSyntaxError
when a function was not closed, but an inner function was.
Features
- Implemented Relative JSON Pointers. Use the
to(rel)
method ofJSONPointer
, whererel
is a relative JSON pointer string and a newJSONPointer
is returned. - Guard against recursive data structures by implementing the
JSONPathEnvironment.maxRecursionDepth
option. When using the recursive descent selector (..
), if the maximum recursion depth is reached, aJSONPathRecursionLimitError
is thrown. - Added
JSONPathEnvironment.match()
andJSONPath.match()
, which returns aJSONPathNode
for the first value matching a query, orundefined
if there are no matches.
Version 0.1.1
Fixes
- Fix number literals with an implicit exponent sign. Previously we would see a
JSONPathSyntaxError
for1e2
, but not for1e+2
or1e-2
. Now1e2
is equivalent to1e+2
.