jmespath-community / typescript-jmespath

TypeScript implementation of JMESPath
Mozilla Public License 2.0
4 stars 2 forks source link

Expression that evaluates to falsy value will return as null instead #26

Closed prndP closed 4 months ago

prndP commented 4 months ago

Hi there. While testing, I noticed a difference in typescript-jmespath behavior vs jmespath.js

For the following condition, I would expect the result of the expression to be 0. Today it returns null

{
   "given":
       {"foo": {"bar": 0}},
   "cases": [
       {
           "expression": "foo.bar",
           "result": 0
       }
   ]
}

I could raise a set of PRs which I believe will solve the issue. Thanks

springcomp commented 4 months ago

Indeed you are right. Thanks for the feedback. A pull request would be awesome, thank you for your proposal.