$$is
Returns true
if all predicates arguments are satisfied.
Usage​
{
"$$is": /* value to check */,
"in": [ /* possible values */ ],
"nin": [ /* forbidden values */ ],
"eq": /* value to equal */,
"neq": /* value to not equal */,
"gt": /* value to be greater than */,
"gte": /* value to be greater than or equal */,
"lt": /* value to be lower than */,
"lte": /* value to be lower than or equal */,
}
Returns​
boolean
Arguments​
Argument | Type | Values | Required / Default Value | Description |
---|---|---|---|---|
Primary | Yes | Value to check against | ||
in | array | Array of values the input should be part of | ||
nin | array | Array of values the input should NOT be part of | ||
eq | (same as input) | A Value the input should be equal to | ||
neq | A Value the input should NOT be equal to | |||
gt | (same as input) | A Value the input should be greater than (input > value) | ||
gte | (same as input) | A Value the input should be greater than or equal (input >= value) | ||
lt | (same as input) | A Value the input should be lower than (input < value) | ||
lte | (same as input) | A Value the input should be lower than or equal (input <= value) |
gt
/gte
/lt
/lte
- Uses the comparison logic
Examples​
Input
Definition
Output
"TEST"
{ "$$is": "$", "eq": "TEST" }
true
"TEST"
{ "$$is": "$", "neq": "TEST" }
false
"DEV"
{ "$$is": "$", "in": ["DEV","PROD"] }
true
"DEV"
{ "$$is": "$", "nin": ["DEV","TEST"] }
false
2
{ "$$is": "$", "gt": 1, "lt": 3 }
true
1
{ "$$is": "$", "gt": 1, "lt": 3 }
false
3
{ "$$is": "$", "gt": 1, "lt": 3 }
false
[ { "a": 1 } ]
{
"$$is": "$",
"in":[
[ {"a": 4} ],
[ {"a": 1} ],
[ {"a": 3} ]
]
}
true