time-to-botec

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

repl.txt (1029B)


      1 
      2 {{alias}}( obj, transform )
      3     Maps keys from one object to a new object having the same values.
      4 
      5     The transform function is provided three arguments:
      6 
      7     - `key`: object key
      8     - `value`: object value corresponding to `key`
      9     - `obj`: the input object
     10 
     11     The value returned by a transform function should be a value which can be
     12     serialized as an object key.
     13 
     14     The function only maps own properties. Hence, the function does not map
     15     inherited properties.
     16 
     17     The function shallow copies key values.
     18 
     19     Key iteration order is *not* guaranteed.
     20 
     21     Parameters
     22     ----------
     23     obj: Object
     24         Source object.
     25 
     26     transform: Function
     27         Transform function. Return values specify the keys of the output object.
     28 
     29     Returns
     30     -------
     31     out: Object
     32         New object.
     33 
     34     Examples
     35     --------
     36     > function transform( key, value ) { return key + value; };
     37     > var obj = { 'a': 1, 'b': 2 };
     38     > var out = {{alias}}( obj, transform )
     39     { 'a1': 1, 'b2': 2 }
     40 
     41     See Also
     42     --------
     43