You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I know that it can't be changed now, because that would break existing code. But I suspect there is code out there that assumes that all will return true on an empty set and is already broken. What I think needs to happen is that this is mentioned in the documentation as a big fat warning, so that people are aware of this unexpected behavior and write code accordingly.
The text was updated successfully, but these errors were encountered:
panzi
changed the title
all on empty array should return true
document that all on an empty set returns falseAug 23, 2021
In every other language
all()
(orevery()
) returnstrue
for an empty set (see e.g.every()
in JavaScript: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every#description). This is because it is defined as (except with short circuiting):json-logic-js/logic.js
Lines 317 to 319 in c1dd82f
I know that it can't be changed now, because that would break existing code. But I suspect there is code out there that assumes that
all
will returntrue
on an empty set and is already broken. What I think needs to happen is that this is mentioned in the documentation as a big fat warning, so that people are aware of this unexpected behavior and write code accordingly.The text was updated successfully, but these errors were encountered: