diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index bb4f464a7..cb1e0fa0a 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -326,6 +326,8 @@ result = <_.LoDashArrayWrapper>_([1, 2, 3, 4, 5]).xor([5, 2, 10], [4, 5, result = _.zip(['moe', 'larry'], [30, 40], [true, false]); 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(); // /* ************* // * Collections * @@ -381,6 +383,11 @@ result = _.find([1, 2, 3, 4], function (num) { }); result = _.find(foodsCombined, { 'type': 'vegetable' }); result = _.find(foodsCombined, 'organic'); +result = _([1, 2, 3, 4]).find(function (num) { + return num % 2 == 0; +}); +result = _(foodsCombined).find({ 'type': 'vegetable' }); +result = _(foodsCombined).find('organic'); result = _.detect([1, 2, 3, 4], function (num) { return num % 2 == 0; @@ -400,6 +407,12 @@ result = _.findLast([1, 2, 3, 4], function (num) { result = _.findLast(foodsCombined, { 'type': 'vegetable' }); result = _.findLast(foodsCombined, 'organic'); +result = _([1, 2, 3, 4]).findLast(function (num) { + return num % 2 == 0; +}); +result = _(foodsCombined).findLast({ 'type': 'vegetable' }); +result = _(foodsCombined).findLast('organic'); + result = _.forEach([1, 2, 3], function (num) { console.log(num); }); result = <_.Dictionary>_.forEach({ 'one': 1, 'two': 2, 'three': 3 }, function (num) { console.log(num); }); result = _.forEach({ name: 'apple', type: 'fruit' }, function (value, key) { console.log(value, key) }); @@ -468,10 +481,16 @@ result = _(stoogesAges).collect('name').value(); result = _.max([4, 2, 8, 6]); result = _.max(stoogesAges, function (stooge) { return stooge.age; }); result = _.max(stoogesAges, 'age'); +result = <_.LoDashWrapper>_([4, 2, 8, 6]).max(); +result = <_.LoDashWrapper>_(stoogesAges).max(function (stooge) { return stooge.age; }); +result = <_.LoDashWrapper>_(stoogesAges).max('age'); result = _.min([4, 2, 8, 6]); result = _.min(stoogesAges, function (stooge) { return stooge.age; }); result = _.min(stoogesAges, 'age'); +result = <_.LoDashWrapper>_([4, 2, 8, 6]).min(); +result = <_.LoDashWrapper>_(stoogesAges).min(function (stooge) { return stooge.age; }); +result = <_.LoDashWrapper>_(stoogesAges).min('age'); result = _.pluck(stoogesAges, 'name'); result = _(stoogesAges).pluck('name').value(); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 3e3fd43d7..93c6b6ee4 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -2027,6 +2027,18 @@ declare module _ { unzip(...arrays: any[]): any[]; } + interface LoDashArrayWrapper { + /** + * @see _.zip + **/ + zip(...arrays: any[][]): _.LoDashArrayWrapper; + + /** + * @see _.zip + **/ + unzip(...arrays: any[]): _.LoDashArrayWrapper; + } + //_.zipObject interface LoDashStatic { /** @@ -2860,6 +2872,28 @@ declare module _ { pluckValue: string): T; } + interface LoDashArrayWrapper { + /** + * @see _.find + */ + find( + callback: ListIterator, + thisArg?: any): T; + /** + * @see _.find + * @param _.where style callback + */ + find( + whereValue: W): T; + + /** + * @see _.find + * @param _.where style callback + */ + find( + pluckValue: string): T; + } + //_.findLast interface LoDashStatic { /** @@ -2940,6 +2974,28 @@ declare module _ { pluckValue: string): T; } + interface LoDashArrayWrapper { + /** + * @see _.findLast + */ + findLast( + callback: ListIterator, + thisArg?: any): T; + /** + * @see _.findLast + * @param _.where style callback + */ + findLast( + whereValue: W): T; + + /** + * @see _.findLast + * @param _.where style callback + */ + findLast( + pluckValue: string): T; + } + //_.forEach interface LoDashStatic { /** @@ -3620,6 +3676,29 @@ declare module _ { whereValue: W): T; } + interface LoDashArrayWrapper { + /** + * @see _.max + **/ + max( + callback?: ListIterator, + thisArg?: any): LoDashWrapper; + + /** + * @see _.max + * @param pluckValue _.pluck style callback + **/ + max( + pluckValue: string): LoDashWrapper; + + /** + * @see _.max + * @param whereValue _.where style callback + **/ + max( + whereValue: W): LoDashWrapper; + } + //_.min interface LoDashStatic { /** @@ -3708,6 +3787,29 @@ declare module _ { whereValue: W): T; } + interface LoDashArrayWrapper { + /** + * @see _.min + **/ + min( + callback?: ListIterator, + thisArg?: any): LoDashWrapper; + + /** + * @see _.min + * @param pluckValue _.pluck style callback + **/ + min( + pluckValue: string): LoDashWrapper; + + /** + * @see _.min + * @param whereValue _.where style callback + **/ + min( + whereValue: W): LoDashWrapper; + } + //_.pluck interface LoDashStatic { /**