This set of changes allows JSON Logic engine to more strictly honor s… #37
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While the operators I implemented were compatible with the base spec, the interpreter was not implemented to actually sugar / desugar single arguments. In terms of compatibility, this has not created issues for anyone, but it was possible to add new operators that would not receive arrays as arguments.
I considered this to be a good thing / an option to be flexible, but with https://github.com/json-logic, I'd like to try to be more rigid with what I allow.
However, I've compromised by allowing users to add a flag to enable them to say
optimizeUnary
on an operator. This argument is used to signify "Hey, I support arrays, but I also support direct input if you want to invoke me with that". This allows my compiler & optimizer to avoid array destructuring overhead, which can actually have semi-significant impact (it did in the Handlebars JLE Library)Because this change makes adding operators a bit more rigid, and semi-ensures that args will always be an array, I'm bumping the major version flag once more.
I've also changed the layout for some of my tests. Over time, I'm going to move more JSON files into the
suites
directory.