jmespath / jmespath/jmespath.js

Length throws an error when evaluating a null node

Open
#29 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

If the expression passed to a `length` function call resolves to `null`, an error will be thrown. Normally, evaluating any JMESPath expression will return a result or `null`, but if that expression calls any functions then it must be wrapped in a `try/catch` block to be safely evaluated.

This seems to be in compliance with [the specification](http://jmespath.org/specification.html), which states that "Specifying an invalid type for a function argument will result in a JMESPath error." However, this requires callers to know about the content of a given JMESPath expression before evaluating it.

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.