You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the process of familiarizing myself with jsonata.js I ran across the following ...
The JSONata documentation states that non-integer array indexes are rounded down in Navigating JSON Arrays.
In applyPredicates() and evaluateFilter(), the predicate Number.isInteger() is used to determine whether or not Math.floor() should be called. The implementation of Number.isInteger() itself ends up using Math.floor() ... either implicitly or explicitly.
I suggest that it would be simpler and more efficient to simply call Math.floor() directly:
if (!Number.isInteger(ires)) {
// round it down
ires = Math.floor(ires);
}
becomes
ires = Math.floor(ires)
The text was updated successfully, but these errors were encountered:
In the process of familiarizing myself with jsonata.js I ran across the following ...
The JSONata documentation states that non-integer array indexes are rounded down in Navigating JSON Arrays.
In applyPredicates() and evaluateFilter(), the predicate Number.isInteger() is used to determine whether or not Math.floor() should be called. The implementation of Number.isInteger() itself ends up using Math.floor() ... either implicitly or explicitly.
I suggest that it would be simpler and more efficient to simply call Math.floor() directly:
becomes
The text was updated successfully, but these errors were encountered: