@@ -25,17 +25,17 @@ import { Collection } from '@stdlib/types/array';
25
25
/**
26
26
* Interface defining base function options.
27
27
*/
28
- interface BaseOptions < T > {
28
+ interface BaseOptions < T , U > {
29
29
/**
30
30
* Execution context.
31
31
*/
32
- thisArg ?: ThisParameterType < Predicate < T > > ;
32
+ thisArg ?: ThisParameterType < Predicate < T , U > > ;
33
33
}
34
34
35
35
/**
36
36
* Interface defining function options when returning indices.
37
37
*/
38
- interface IndicesOptions < T > extends BaseOptions < T > {
38
+ interface IndicesOptions < T , U > extends BaseOptions < T , U > {
39
39
/**
40
40
* Specifies that indices should be returned.
41
41
*/
@@ -45,7 +45,7 @@ interface IndicesOptions<T> extends BaseOptions<T> {
45
45
/**
46
46
* Interface defining function options when returning values.
47
47
*/
48
- interface ValuesOptions < T > extends BaseOptions < T > {
48
+ interface ValuesOptions < T , U > extends BaseOptions < T , U > {
49
49
/**
50
50
* Specifies that values should be returned.
51
51
*/
@@ -55,7 +55,7 @@ interface ValuesOptions<T> extends BaseOptions<T> {
55
55
/**
56
56
* Interface defining function options when returning indices and values.
57
57
*/
58
- interface IndicesAndValuesOptions < T > extends BaseOptions < T > {
58
+ interface IndicesAndValuesOptions < T , U > extends BaseOptions < T , U > {
59
59
/**
60
60
* Specifies that indices and values should be returned.
61
61
*/
@@ -67,15 +67,15 @@ interface IndicesAndValuesOptions<T> extends BaseOptions<T> {
67
67
*
68
68
* @returns boolean indicating whether an element in a collection should be placed in the first or second group
69
69
*/
70
- type Nullary = ( ) => boolean ;
70
+ type Nullary < U > = ( this : U ) => boolean ;
71
71
72
72
/**
73
73
* Returns a boolean indicating which group an element in an collection belongs to.
74
74
*
75
75
* @param value - collection value
76
76
* @returns boolean indicating whether an element in a collection should be placed in the first or second group
77
77
*/
78
- type Unary < T > = ( value : T ) => boolean ;
78
+ type Unary < T , U > = ( this : U , value : T ) => boolean ;
79
79
80
80
/**
81
81
* Returns a boolean indicating which group an element in an collection belongs to.
@@ -84,7 +84,7 @@ type Unary<T> = ( value: T ) => boolean;
84
84
* @param index - collection index
85
85
* @returns boolean indicating whether an element in a collection should be placed in the first or second group
86
86
*/
87
- type Binary < T > = ( value : T , index : number ) => boolean ;
87
+ type Binary < T , U > = ( this : U , value : T , index : number ) => boolean ;
88
88
89
89
/**
90
90
* Returns a boolean indicating which group an element in an collection belongs to.
@@ -93,7 +93,7 @@ type Binary<T> = ( value: T, index: number ) => boolean;
93
93
* @param index - collection index
94
94
* @returns boolean indicating whether an element in a collection should be placed in the first or second group
95
95
*/
96
- type Predicate < T > = Nullary | Unary < T > | Binary < T > ;
96
+ type Predicate < T , U > = Nullary < U > | Unary < T , U > | Binary < T , U > ;
97
97
98
98
/**
99
99
* Splits values into two groups according to a predicate function.
@@ -122,7 +122,7 @@ type Predicate<T> = Nullary | Unary<T> | Binary<T>;
122
122
* var out = bifurcateBy( arr, predicate );
123
123
* // returns [ [ 'beep', 'boop', 'bar' ], [ 'foo' ] ]
124
124
*/
125
- declare function bifurcateBy < T = unknown > ( collection : Collection < T > , predicate : Predicate < T > ) : [ Array < T > , Array < T > ] ;
125
+ declare function bifurcateBy < T = unknown , U = unknown > ( collection : Collection < T > , predicate : Predicate < T , U > ) : [ Array < T > , Array < T > ] ; // tslint:disable-line:no-unnecessary-generics
126
126
127
127
/**
128
128
* Splits values into two groups according to a predicate function.
@@ -157,7 +157,7 @@ declare function bifurcateBy<T = unknown>( collection: Collection<T>, predicate:
157
157
* var out = bifurcateBy( arr, opts, predicate );
158
158
* // returns [ [ 0, 1, 3 ], [ 2 ] ]
159
159
*/
160
- declare function bifurcateBy < T = unknown > ( collection : Collection < T > , options : IndicesOptions < T > , predicate : Predicate < T > ) : [ Array < number > , Array < number > ] ;
160
+ declare function bifurcateBy < T = unknown , U = unknown > ( collection : Collection < T > , options : IndicesOptions < T , U > , predicate : Predicate < T , U > ) : [ Array < number > , Array < number > ] ;
161
161
162
162
/**
163
163
* Splits values into two groups according to a predicate function.
@@ -192,7 +192,7 @@ declare function bifurcateBy<T = unknown>( collection: Collection<T>, options: I
192
192
* var out = bifurcateBy( arr, opts, predicate );
193
193
* // returns [ [ 'beep', 'boop', 'bar' ], [ 'foo' ] ]
194
194
*/
195
- declare function bifurcateBy < T = unknown > ( collection : Collection < T > , options : ValuesOptions < T > | BaseOptions < T > , predicate : Predicate < T > ) : [ Array < T > , Array < T > ] ;
195
+ declare function bifurcateBy < T = unknown , U = unknown > ( collection : Collection < T > , options : ValuesOptions < T , U > | BaseOptions < T , U > , predicate : Predicate < T , U > ) : [ Array < T > , Array < T > ] ;
196
196
197
197
/**
198
198
* Splits values into two groups according to a predicate function.
@@ -227,7 +227,7 @@ declare function bifurcateBy<T = unknown>( collection: Collection<T>, options: V
227
227
* var out = bifurcateBy( arr, opts, predicate );
228
228
* // returns [ [ [ 0, 'beep' ], [ 1, 'boop' ], [ 3, 'bar' ] ], [ [ 2, 'foo' ] ] ]
229
229
*/
230
- declare function bifurcateBy < T = unknown > ( collection : Collection < T > , options : IndicesAndValuesOptions < T > , predicate : Predicate < T > ) : [ Array < [ number , T ] > , Array < [ number , T ] > ] ;
230
+ declare function bifurcateBy < T = unknown , U = unknown > ( collection : Collection < T > , options : IndicesAndValuesOptions < T , U > , predicate : Predicate < T , U > ) : [ Array < [ number , T ] > , Array < [ number , T ] > ] ;
231
231
232
232
233
233
// EXPORTS //
0 commit comments