time-to-botec

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

repl.txt (1126B)


      1 
      2 {{alias}}( collection, fcn[, thisArg] )
      3     Converts a collection to an object whose keys are determined by a provided
      4     function and whose values are the collection values.
      5 
      6     When invoked, the input function is provided two arguments:
      7 
      8     - `value`: collection value
      9     - `index`: collection index
     10 
     11     If more than one element in a collection resolves to the same key, the key
     12     value is the collection element which last resolved to the key.
     13 
     14     Object values are shallow copies.
     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     fcn: Function
     23         The function to invoke for each element in a collection.
     24 
     25     thisArg: any (optional)
     26         Execution context.
     27 
     28     Returns
     29     -------
     30     out: Object
     31         Output object.
     32 
     33     Examples
     34     --------
     35     > function toKey( v ) { return v.a; };
     36     > var arr = [ { 'a': 1 }, { 'a': 2 } ];
     37     > {{alias}}( arr, toKey )
     38     { '1': { 'a': 1 }, '2': { 'a': 2 } }
     39 
     40     See Also
     41     --------
     42