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