Array~funcprog-extras Class
Item Index
Methods
- findIndexOf static
- mapToObject static
- reduceRight static
Methods
findIndexOf
-
a
-
f
-
c
Executes the supplied function on each item in the array, searching for the first item that matches the supplied function. The function receives the value, the index, and the array itself as parameters (in that order).
Parameters:
-
a
Arraythe array to iterate
-
f
Functionthe function to execute on each item
-
c
Objectoptional context object
Returns:
mapToObject
-
a
-
f
-
c
Executes the supplied function on each item in the array and returns an object with the results. The function receives the value, the key, and the object itself as parameters (in that order). The function must return an array with two elements (key, value), which will be mixed into the result.
Parameters:
-
a
Mixedthe array to iterate
-
f
Stringthe function to execute on each item
-
c
Objectoptional context object
Returns:
reduceRight
-
a
-
init
-
f
-
c
Executes the supplied function on each item in the array, starting from the end and folding the list into a single value. The function receives the value returned by the previous iteration (or the initial value if this is the first iteration), the value being iterated, the index, and the list itself as parameters (in that order). The function must return the updated value.
Parameters:
-
a
Arraythe array to iterate
-
init
Mixedthe initial value
-
f
Stringthe function to execute on each item
-
c
Objectoptional context object