jmespath/jmespath.js

Ordering operators aren't limited to numbers

Opened this issue · 0 comments

Per documentation:

Ordering operators >, >=, <, <= are only valid for numbers. Evaluating any other type with a comparison operator will yield a null value

But this library seems to follow native JavaScript rules instead, allowing e.g. strings to be used in comparisons with non-null results: https://runkit.com/embed/6yymqriowri5

{actual: true, expected: true, expression: "`0` < `1`", scenario: "number ordering_comparator number"}
{actual: true, expected: null, expression: "`0` < '1'", scenario: "number ordering_comparator string"}
{actual: true, expected: null, expression: "'a' < 'b'", scenario: "string ordering_comparator string"}