packages feed

jsonlogic-hs-0.1.0.0: test/community/exists.json

[
    "Test Specification for exists",
    {
        "description": "Checks if a normal key exists",
        "rule": { "exists": "hello" },
        "data": { "hello" : 1 },
        "result": true
    },
    {
        "description": "Checks if a normal key exists (array)",
        "rule": { "exists": ["hello"] },
        "data": { "hello" : 1 },
        "result": true
    },
    {
        "description": "Checks if a normal key exists (false)",
        "rule": { "exists": "hello" },
        "data": { "world" : 1 },
        "result": false
    },
    {
        "description": "Checks if an empty key exists (true)",
        "rule": { "exists": [""] },
        "data": { "" : 1 },
        "result": true
    },
    {
        "description": "Checks if an empty key exists (false)",
        "rule": { "exists": [""] },
        "data": { "hello" : 1 },
        "result": false
    },
    {
        "description": "Checks if a nested key exists",
        "rule": { "exists": ["hello", "world"] },
        "data": { "hello" : { "world": false } },
        "result": true
    },
    {
        "description": "Checks if a nested key exists (false)",
        "rule": { "exists": ["hello", "world"] },
        "data": { "hello" : { "x": false } },
        "result": false
    },
    {
        "description": "Checks if a null value exists",
        "rule": { "exists": "hello" },
        "data": { "hello" : null },
        "result": true
    }
]