-
-
Notifications
You must be signed in to change notification settings - Fork 810
/
Copy pathrepl.txt
34 lines (26 loc) · 840 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
{{alias}}( x, groups )
Groups elements as arrays associated with distinct keys.
If provided an empty array, the function returns an empty object.
Parameters
----------
x: ArrayLike
Input array.
groups: ArrayLike
An array defining which group an element in the input array belongs to.
Each value in `groups` should resolve to a value which can be serialized
as an object key.
Returns
-------
out: Object
Group results.
Examples
--------
> var x = [ 'beep', 'boop', 'foo', 'bar' ];
> var g = [ 'b', 'b', 'f', 'b' ];
> var out = {{alias}}( x, g )
{ 'b': [ 'beep', 'boop', 'bar' ], 'f': [ 'foo' ] }
> g = [ 1, 1, 2, 1 ];
> out = {{alias}}( x, g )
{ '1': [ 'beep', 'boop', 'bar' ], '2': [ 'foo' ] }
See Also
--------