Conversation
iyk2h
marked this pull request as draft
August 25, 2026 01:36
Author
|
Converting this to a draft per the feedback in #58 — I've opened a Phase 0 proposal for these operators as a community array extension, following the TC process: https://github.com/orgs/json-logic/discussions/50 Keeping this PR around as the JS reference implementation (the test suite here follows TEST_FORMAT.md). I'll mark it ready or close it depending on how the proposal lands. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #58
Adds three array containment operators —
contains_all,contains_any,contains_none— for array-to-array comparison, as proposed in #58.Semantics
{"contains_all": [["a","b","c"], ["a","b"]]}true{"contains_all": [["a","b","c"], []]}true(vacuous){"contains_any": [["a","b","c"], ["x","b"]]}true{"contains_any": [["a","b","c"], []]}false{"contains_none": [["a","b","c"], ["x","y"]]}true{"contains_none": [["a","b","c"], []]}true(vacuous)in's(array || [])handling, so a missingvardegrades gracefully instead of throwing.in), via aSetover the haystack for O(n+m).Implementation notes
defaultMethods.js, so they are automaticallySyncanddeterministic— they work unchanged across sync/async engines, inline/no-inline, and both optimizer modes.suites/comparison/contains.json(29 cases mirroring the Go test matrix plusvar-resolution and missing-data cases) — picked up bycompatible.test.js, giving 464 test executions across the 8 engine configurations.Verification
jest: 19,142 passed, 0 failed (full suite including the new cases)standard: clean