diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 5b9add244..167620da5 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -363,6 +363,24 @@ result = _(['A', 'b', 'C', 'a', 'B', 'c']).unique(function (letter) { result = _([1, 2.5, 3, 1.5, 2, 3.5]).unique(function (num) { return this.floor(num); }, Math).value(); result = <{ x: number; }[]>_([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }]).unique('x').value(); +// _.unzipWith +{ + let testUnzipWithArray: (number[]|_.List)[]; + let testUnzipWithList: _.List>; + let testUnzipWithIterator: {(prev: TResult, curr: number, index?: number, list?: number[]): TResult}; + let result: TResult[]; + result = _.unzipWith(testUnzipWithArray); + result = _.unzipWith(testUnzipWithArray, testUnzipWithIterator); + result = _.unzipWith(testUnzipWithArray, testUnzipWithIterator, any); + result = _.unzipWith(testUnzipWithList); + result = _.unzipWith(testUnzipWithList, testUnzipWithIterator); + result = _.unzipWith(testUnzipWithList, testUnzipWithIterator, any); + result = _(testUnzipWithArray).unzipWith(testUnzipWithIterator).value(); + result = _(testUnzipWithArray).unzipWith(testUnzipWithIterator, any).value(); + result = _(testUnzipWithList).unzipWith(testUnzipWithIterator).value(); + result = _(testUnzipWithList).unzipWith(testUnzipWithIterator, any).value(); +} + result = _.without([1, 2, 1, 0, 3, 1, 4], 0, 1); // _.xor diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index b6c95710b..077576a84 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -1852,6 +1852,45 @@ declare module _ { whereValue: W): LoDashArrayWrapper; } + //_.unzipWith + interface LoDashStatic { + /** + * This method is like _.unzip except that it accepts an iteratee to specify how regrouped values should be + * combined. The iteratee is bound to thisArg and invoked with four arguments: (accumulator, value, index, + * group). + * + * @param array The array of grouped elements to process. + * @param iteratee The function to combine regrouped values. + * @param thisArg The this binding of iteratee. + * @return Returns the new array of regrouped elements. + */ + unzipWith( + array: List>, + iteratee?: MemoIterator, + thisArg?: any + ): TResult[]; + } + + interface LoDashArrayWrapper { + /** + * @see _.unzipWith + */ + unzipWith( + iteratee?: MemoIterator, + thisArg?: any + ): LoDashArrayWrapper; + } + + interface LoDashObjectWrapper { + /** + * @see _.unzipWith + */ + unzipWith( + iteratee?: MemoIterator, + thisArg?: any + ): LoDashArrayWrapper; + } + //_.without interface LoDashStatic { /** @@ -8489,10 +8528,10 @@ declare module _ { } interface MemoVoidIterator { - (prev: TResult, curr: T, indexOrKey: any, list?: T[]): void; + (prev: TResult, curr: T, indexOrKey?: any, list?: T[]): void; } interface MemoIterator { - (prev: TResult, curr: T, indexOrKey: any, list?: T[]): TResult; + (prev: TResult, curr: T, indexOrKey?: any, list?: T[]): TResult; } /* interface MemoListIterator {