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