mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Merge pull request #5391 from chrootsu/lodash-zipWith
lodash: added _.zipWith() method
This commit is contained in:
@@ -380,6 +380,22 @@ result = <any[][]>_.unzip(['moe', 'larry'], [30, 40], [true, false]);
|
||||
result = <any[][]>_(['moe', 'larry']).zip([30, 40], [true, false]).value();
|
||||
result = <any[][]>_(['moe', 'larry']).unzip([30, 40], [true, false]).value();
|
||||
|
||||
// _.zipWith
|
||||
interface TestZipWithFn {
|
||||
(a1: number, a2: number): number;
|
||||
}
|
||||
var testZipWithFn: TestZipWithFn;
|
||||
result = <number[]>_.zipWith<number>([1, 2]);
|
||||
result = <number[]>_.zipWith<number>([1, 2], testZipWithFn);
|
||||
result = <number[]>_.zipWith<number>([1, 2], testZipWithFn, any);
|
||||
result = <number[]>_.zipWith<number>([1, 2], [1, 2], testZipWithFn, any);
|
||||
result = <number[]>_.zipWith<number>([1, 2], [1, 2], [1, 2], [1, 2], [1, 2], [1, 2], testZipWithFn, any);
|
||||
result = <number[]>_([1, 2]).zipWith<number>().value();
|
||||
result = <number[]>_([1, 2]).zipWith<number>(testZipWithFn).value();
|
||||
result = <number[]>_([1, 2]).zipWith<number>(testZipWithFn, any).value();
|
||||
result = <number[]>_([1, 2]).zipWith<number>([1, 2], testZipWithFn, any).value();
|
||||
result = <number[]>_([1, 2]).zipWith<number>([1, 2], [1, 2], [1, 2], [1, 2], [1, 2], testZipWithFn, any).value();
|
||||
|
||||
// /* *************
|
||||
// * Collections *
|
||||
// ************* */
|
||||
|
||||
Vendored
+21
@@ -1979,6 +1979,27 @@ declare module _ {
|
||||
object(values?: List<any>): _.LoDashObjectWrapper<Dictionary<any>>;
|
||||
}
|
||||
|
||||
//_.zipWith
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* This method is like _.zip except that it accepts an iteratee to specify how grouped values should be
|
||||
* combined. The iteratee is bound to thisArg and invoked with four arguments: (accumulator, value, index,
|
||||
* group).
|
||||
* @param {...Array} [arrays] The arrays to process.
|
||||
* @param {Function} [iteratee] The function to combine grouped values.
|
||||
* @param {*} [thisArg] The `this` binding of `iteratee`.
|
||||
* @return Returns the new array of grouped elements.
|
||||
*/
|
||||
zipWith<TResult>(...args: any[]): TResult[];
|
||||
}
|
||||
|
||||
interface LoDashArrayWrapper<T> {
|
||||
/**
|
||||
* @see _.zipWith
|
||||
*/
|
||||
zipWith<TResult>(...args: any[]): LoDashArrayWrapper<TResult>;
|
||||
}
|
||||
|
||||
/* *************
|
||||
* Collections *
|
||||
************* */
|
||||
|
||||
Reference in New Issue
Block a user