time-to-botec

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

repl.txt (1281B)


      1 
      2 {{alias}}( collection, n, predicate[, thisArg ] )
      3     Tests whether a collection contains at least `n` elements which pass a test
      4     implemented by a predicate function, iterating from right to left.
      5 
      6     The predicate function is provided three arguments:
      7 
      8     - `value`: collection value
      9     - `index`: collection index
     10     - `collection`: the input collection
     11 
     12     The function immediately returns upon finding `n` successful elements.
     13 
     14     If provided an empty collection, the function returns `false`.
     15 
     16     Parameters
     17     ----------
     18     collection: Array|TypedArray|Object
     19         Input collection over which to iterate. If provided an object, the
     20         object must be array-like (excluding strings and functions).
     21 
     22     n: number
     23         Minimum number of successful elements.
     24 
     25     predicate: Function
     26         The test function.
     27 
     28     thisArg: any (optional)
     29         Execution context.
     30 
     31     Returns
     32     -------
     33     bool: boolean
     34         The function returns `true` if a collection contains at least `n`
     35         successful elements; otherwise, the function returns `false`.
     36 
     37     Examples
     38     --------
     39     > function negative( v ) { return ( v < 0 ); };
     40     > var arr = [ -1, 1, -2, 3, 4 ];
     41     > var bool = {{alias}}( arr, 2, negative )
     42     true
     43 
     44     See Also
     45     --------
     46