You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This class is especially useful for v1, which has no fat-arrow function. For example, if you define a function that takes a function and retrieves only certain values of an array, as follows.
; 1.1.33.10SelectArr(arr, predicate) {
selected := []
for i, value in arr {
if (%predicate%(value, i, arr)) {
selected.push(value)
}
}
return selected
}
Tasks
Predicate refers to a function that returns a boolean, like the IsObject function.
Predicate takes one or two or more arguments. The first argument is always the value to be checked.
It is used as follows.
If the predicate does not have enough arguments, it will be partially applied starting with the second argument.
This is valid where you want to check the values more specifically, as in the following.
There are several variations of each predicate.
all
,any
, andnone
are useful for checking multiple values. It takes an array of values to check.These can be combined to create new predicate.
This class is especially useful for v1, which has no fat-arrow function. For example, if you define a function that takes a function and retrieves only certain values of an array, as follows.
You can use this function in the follows way.
The text was updated successfully, but these errors were encountered: