diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index f69428dc0..c68e0f9e3 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -380,6 +380,22 @@ result = _.unzip(['moe', 'larry'], [30, 40], [true, false]); result = _(['moe', 'larry']).zip([30, 40], [true, false]).value(); result = _(['moe', 'larry']).unzip([30, 40], [true, false]).value(); +// _.zipWith +interface TestZipWithFn { + (a1: number, a2: number): number; +} +var testZipWithFn: TestZipWithFn; +result = _.zipWith([1, 2]); +result = _.zipWith([1, 2], testZipWithFn); +result = _.zipWith([1, 2], testZipWithFn, any); +result = _.zipWith([1, 2], [1, 2], testZipWithFn, any); +result = _.zipWith([1, 2], [1, 2], [1, 2], [1, 2], [1, 2], [1, 2], testZipWithFn, any); +result = _([1, 2]).zipWith().value(); +result = _([1, 2]).zipWith(testZipWithFn).value(); +result = _([1, 2]).zipWith(testZipWithFn, any).value(); +result = _([1, 2]).zipWith([1, 2], testZipWithFn, any).value(); +result = _([1, 2]).zipWith([1, 2], [1, 2], [1, 2], [1, 2], [1, 2], testZipWithFn, any).value(); + // /* ************* // * Collections * // ************* */ diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 5e1ebfa51..cbd83358c 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -1979,6 +1979,27 @@ declare module _ { object(values?: List): _.LoDashObjectWrapper>; } + //_.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(...args: any[]): TResult[]; + } + + interface LoDashArrayWrapper { + /** + * @see _.zipWith + */ + zipWith(...args: any[]): LoDashArrayWrapper; + } + /* ************* * Collections * ************* */