From 2507e73a5fcc59f504fd5c70d23c230cfa0458d6 Mon Sep 17 00:00:00 2001 From: motemen Date: Sat, 18 Oct 2014 18:07:02 +0900 Subject: [PATCH] _(...).find --- lodash/lodash-tests.ts | 5 +++++ lodash/lodash.d.ts | 22 ++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 2d6335d70..cb1e0fa0a 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -383,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; diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 85a406e38..93c6b6ee4 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -2872,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 { /**