Powered By GitBook
EVERY
Check if all items in a list match

Description

Checks if every item in the given list match the given criteria. Returns true each value matches, otherwise false. Returns true also if the list is empty.
The criteria is defined as a formula at the second parameter. The formula is evaluated with each item in the list. The formula must result in a true/false value. When the formula results in false, then the function will also return false.

Function signature

1
EVERY(list: Array, selectionformula: Function) => Boolean
Copied!
Parameter
Description
List
List of items to search
Selection formula
Formula used to determine if an item matches the criteria

Examples

1
animals = [
2
{
3
"name": "dog",
4
"weight": 123
5
},
6
{
7
"name": "cat",
8
"weight": 48
9
},
10
{
11
"name": "rat",
12
"weight": 10
13
},
14
{
15
"name": "pig",
16
"weight": 230
17
}
18
]
19
products = [
20
{
21
"name": "Duct tape",
22
"category": "Utility"
23
},
24
{
25
"name": "Swiss army knife",
26
"category": "Tools"
27
},
28
{
29
"name": "Glue",
30
"category": "Utility"
31
}
32
]
Copied!
Formula
Return value
EVERY(animals, item.weight > 5)
true
EVERY(animals, item.weight < 100)
false
EVERY(animals, item.name != "horse")
true
EVERY<product>(products, product.category == "Utility")
false
Last modified 10mo ago
Export as PDF
Copy link