Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add array "intersection" operator #42

Open
laszlo-hermann-trimble opened this issue Jan 12, 2024 · 0 comments
Open

Add array "intersection" operator #42

laszlo-hermann-trimble opened this issue Jan 12, 2024 · 0 comments

Comments

@laszlo-hermann-trimble
Copy link

Currently there is no way to find out if there are any common elements in two arrays in the data object. This could be achieved by adding a globally available intersection function which returns the common elements in two arrays:

  {"intersection": [{"var": "list1"}, {"var": "list2"]}]

Deciding if there are any elements common to both arrays:

  {
    "some": [{"intersection": [{"var": "list1"}, {"var": "list2"]}], "true"]
  }

Currently this cannot be achieved with the current set of operators since var operations are relative to the array element being tested.

I am aware that a custom operator would solve this problem but instead of writing it privately, I'd prefer contributing so that others could take it into use as well.

What is the recommended way to contribute? Raise a PR into this repo and the JS implementation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant