$$every / $$all
Checks if all elements in an array satisfy a predicate
Usage​
{
"$$every": /* Array of elements */,
"by": /* Transformer(##current) */
}
"$$every(<by>):{input}"
{
"$$all": /* Array of elements */,
"by": /* Transformer(##current) */
}
"$$all(<by>):{input}"
info
predicate by
should resolve to a boolean
value, it uses the truthy logic
Returns​
boolean
Arguments​
Argument | Type | Values | Required / Default Value | Description |
---|---|---|---|---|
Primary | array | Yes | Array of elements | |
by | Transformer(##current ) | Yes | A predicate transformer for an element
|
Examples​
Input
Definition
Output
[
{
"active": true
},
{
"active": true
}
]
"$$every(##current.active):$"
true
[
{
"active": false
},
{
"active": true
}
]
"$$every(##current.active):$"
false
[
{
"active": true
},
{
"active": true
}
]
{
"$$every": "$",
"by": "##current.active"
}
true
[
{
"active": false
},
{
"active": true
}
]
{
"$$every": "$",
"by": "##current.active"
}
false
[
{
"active": true
},
{
"active": true
}
]
{
"$$all": "$",
"by": "##current.active"
}
true