map()
we should have reduce()
.
$
could play a role, by representing the currently being accumulated value in the reduce operation.
There is some caveat when using functions... Imagine you're accessing a node, and there is no such node. So it just returns null
. But when you use a function, such as length()
, if its argument evaluated to null
it throws an error. So we have to check the node first every time we use length()
or use a fallback in the argument:
abc && length(abc) > `0`
or
length(abc || []) > `0`
Would it be nice if it just returned null
instead of throwing an error?
try(length(null), null)
undefined
value.
null
).
contains(1, 2)
try([&length(abc) > `0` && contains(def, 'ghi') && 'yes' || 'no', &'no'])
would be the actual syntax