-
-
Notifications
You must be signed in to change notification settings - Fork 804
/
Copy pathrepl.txt
42 lines (30 loc) · 1.05 KB
/
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
41
{{alias}}( x, predicate[, thisArg] )
Splits element indices into two groups according to a predicate function.
When invoked, the predicate function is provided the following arguments:
- value: current array element.
- index: current array element index.
- arr: input array.
If a predicate function returns a truthy value, an array value is placed in
the first group; otherwise, an array value is placed in the second group.
If provided an empty array, the function returns an empty object.
Parameters
----------
x: ArrayLike
Input array.
predicate: Function
Predicate function specifying which group an element in the input array
belongs to.
thisArg: any (optional)
Predicate function execution context.
Returns
-------
out: Object
Split results.
Examples
--------
> function fcn( v ) { return v[ 0 ] === 'b'; };
> var x = [ 'beep', 'boop', 'foo', 'bar' ];
> var out = {{alias}}( x, fcn )
[ [ 0, 1, 3 ], [ 2 ] ]
See Also
--------