jmespath / jmespath/jmespath.js

Ordering operators aren't limited to numbers

Open
#51 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
847
Forks
101
PR merge metrics
No merged PRs in 30d

Description

Per [documentation](http://jmespath.org/specification.html#ordering-operators):
> 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"}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.