Skip to content

Add array "intersection" operator #42

@laszlo-hermann-trimble

Description

@laszlo-hermann-trimble

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions