jmespath.js
jmespath.js copied to clipboard
Length throws an error when evaluating a null node
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, 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.