time-to-botec

Benchmark sampling in different programming languages
Log | Files | Refs | README

repl.txt (1480B)


      1 
      2 {{alias}}( collection, fcn, predicate[, thisArg] )
      3     Until a test condition is true, invokes a function for each element in a
      4     collection, iterating from right to left.
      5 
      6     The condition is evaluated *after* executing the provided function; thus,
      7     `fcn` *always* executes at least once.
      8 
      9     When invoked, both the predicate function and the function to apply are
     10     provided three arguments:
     11 
     12     - `value`: collection value
     13     - `index`: collection index
     14     - `collection`: the input collection
     15 
     16     If provided an empty collection, both `value` and `index` are `undefined`.
     17 
     18     Parameters
     19     ----------
     20     collection: Array|TypedArray|Object
     21         Input collection over which to iterate. If provided an object, the
     22         object must be array-like (excluding strings and functions).
     23 
     24     fcn: Function
     25         The function to invoke for each element in a collection.
     26 
     27     predicate: Function
     28         The predicate function which indicates whether to stop iterating over a
     29         collection.
     30 
     31     thisArg: any (optional)
     32         Execution context for the applied function.
     33 
     34     Returns
     35     -------
     36     out: Array|TypedArray|Object
     37         Input collection.
     38 
     39     Examples
     40     --------
     41     > function predicate( v ) { return v !== v; };
     42     > function logger( v, i ) { console.log( '%s: %d', i, v ); };
     43     > var arr = [ 1, NaN, 2, 3, 4, 5 ];
     44     > {{alias}}( arr, logger, predicate )
     45     5: 5
     46     4: 4
     47     3: 3
     48     2: 2
     49     1: NaN
     50 
     51     See Also
     52     --------
     53