add 'some', 'all', 'none' operators#25
Conversation
|
Wow, my sincere apologies, I didn't understand what you were doing here until I opened the PR, and this is a really clever addition to the language. Can you take a look at this branch and see if I'm hitting the same requirements you have? Your test cases above pass, and I've got a dozen I'll be adding to the shared unit tests so I can port it to PHP and ping the Ruby implementer. I changed your approach slightly because:
Thanks again for your contribution! |
|
Thanks @jwadhams, we are using these features in production right now. I'm not sure what you are asking me to do here though. |
|
Sorry, what I mean is: I'm about to roll these three operations into the standard JavaScript library. They're in the shared unit tests, lines 291-414: https://github.com/jwadhams/json-logic/blob/gh-pages/tests.json They're listed on the Operations page of the docs (with a disclaimer): http://jsonlogic.com/operations.html#all-none-and-some But my implementation is slightly different from yours (to get IE compatibility mostly), and I wanted to make sure this makes your life better instead of worse. So for the moment it's checked into the main package with the tag |
docs: fix readme var keyword
These new operators allow you to run tests on arrays of objects.
First argument is an array.
Second is a logic object.
The logic object is run with a local scope of each item.