API Docs for: 1.0.0
Show:

Array~funcprog-extras Class

Item Index

Methods

Methods

findIndexOf

(
  • a
  • f
  • c
)
Number static

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 Array

    the array to iterate

  • f Function

    the function to execute on each item

  • c Object

    optional context object

Returns:

Number:

index of the first item for which the supplied function returns true, or -1 if it never returns true

mapToObject

(
  • a
  • f
  • c
)
Object static

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 Mixed

    the array to iterate

  • f String

    the function to execute on each item

  • c Object

    optional context object

Returns:

Object:

object of all return values, constructed via Y.mix

reduceRight

(
  • a
  • init
  • f
  • c
)
Mixed static

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 Array

    the array to iterate

  • init Mixed

    the initial value

  • f String

    the function to execute on each item

  • c Object

    optional context object

Returns:

Mixed:

final result from iteratively applying the given function to each item in the array