Skip to content

filter does not work with the second parameter as var #28

Closed
@tatarysh

Description

@tatarysh

I noticed that in filter, I can't use var (probably loses context to data), it would be nice if you could also use data from data. here is my example of use:

Data

{
    "locale": "pl",
    "locales": [
        {
            "name": "Israel",
            "code": "he",
            "flag": "🇮🇱",
            "iso": "he-IL",
            "dir": "rtl"
        },
        {
            "name": "українська",
            "code": "ue",
            "flag": "🇺🇦",
            "iso": "uk-UA",
            "dir": "ltr"
        },
        {
            "name": "Polski",
            "code": "pl",
            "flag": "🇵🇱",
            "iso": "pl-PL",
            "dir": "ltr"
        }
    ]
}

Valid JSON

{
    "filter": [
        {
            "var": "locales"
        },
        {
            "!==": [
                {
                    "var": "code"
                },
                "pl"
            ]
        }
    ]
}

Invalid JSON

{
    "filter": [
        {
            "var": "locales"
        },
        {
            "!==": [
                {
                    "var": "code"
                },
                {
                    "var": "locale"
                }
            ]
        }
    ]
}

in both cases I should receive:

[{"name":"Israel","code":"he","flag":"🇮🇱","iso":"he-IL","dir":"rtl"},{"name":"українська","code":"ue","flag":"🇺🇦","iso":"uk-UA","dir":"ltr"}]

maybe some additional operator? or maybe _.locale to get access the original data?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions