From ec475225fafa9328fd12d0bb678aa25057e9c6b2 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Fri, 30 Oct 2015 02:16:58 +0500 Subject: [PATCH] lodash: signatures of the method _.every changed --- lodash/lodash-tests.ts | 172 ++++++++++++++++++++++++++--------------- lodash/lodash.d.ts | 100 ++++++++++++++++++++++++ 2 files changed, 210 insertions(+), 62 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 3afc49041..c6c835ce0 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -1635,43 +1635,67 @@ module TestAll { let listIterator: (value: TResult, index: number, collection: _.List) => boolean; let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => boolean; - let result: boolean; + { + let result: boolean; - result = _.all(array); - result = _.all(array, listIterator); - result = _.all(array, listIterator, any); - result = _.all(array, ''); - result = _.all<{a: number}, TResult>(array, {a: 42}); + result = _.all(array); + result = _.all(array, listIterator); + result = _.all(array, listIterator, any); + result = _.all(array, ''); + result = _.all<{a: number}, TResult>(array, {a: 42}); - result = _.all(list); - result = _.all(list, listIterator); - result = _.all(list, listIterator, any); - result = _.all(list, ''); - result = _.all<{a: number}, TResult>(list, {a: 42}); + result = _.all(list); + result = _.all(list, listIterator); + result = _.all(list, listIterator, any); + result = _.all(list, ''); + result = _.all<{a: number}, TResult>(list, {a: 42}); - result = _.all(dictionary); - result = _.all(dictionary, dictionaryIterator); - result = _.all(dictionary, dictionaryIterator, any); - result = _.all(dictionary, ''); - result = _.all<{a: number}, TResult>(dictionary, {a: 42}); + result = _.all(dictionary); + result = _.all(dictionary, dictionaryIterator); + result = _.all(dictionary, dictionaryIterator, any); + result = _.all(dictionary, ''); + result = _.all<{a: number}, TResult>(dictionary, {a: 42}); - result = _(array).all(); - result = _(array).all(listIterator); - result = _(array).all(listIterator, any); - result = _(array).all(''); - result = _(array).all<{a: number}>({a: 42}); + result = _(array).all(); + result = _(array).all(listIterator); + result = _(array).all(listIterator, any); + result = _(array).all(''); + result = _(array).all<{a: number}>({a: 42}); - result = _(list).all(); - result = _(list).all(listIterator); - result = _(list).all(listIterator, any); - result = _(list).all(''); - result = _(list).all<{a: number}>({a: 42}); + result = _(list).all(); + result = _(list).all(listIterator); + result = _(list).all(listIterator, any); + result = _(list).all(''); + result = _(list).all<{a: number}>({a: 42}); - result = _(dictionary).all(); - result = _(dictionary).all(dictionaryIterator); - result = _(dictionary).all(dictionaryIterator, any); - result = _(dictionary).all(''); - result = _(dictionary).all<{a: number}>({a: 42}); + result = _(dictionary).all(); + result = _(dictionary).all(dictionaryIterator); + result = _(dictionary).all(dictionaryIterator, any); + result = _(dictionary).all(''); + result = _(dictionary).all<{a: number}>({a: 42}); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(array).chain().all(); + result = _(array).chain().all(listIterator); + result = _(array).chain().all(listIterator, any); + result = _(array).chain().all(''); + result = _(array).chain().all<{a: number}>({a: 42}); + + result = _(list).chain().all(); + result = _(list).chain().all(listIterator); + result = _(list).chain().all(listIterator, any); + result = _(list).chain().all(''); + result = _(list).chain().all<{a: number}>({a: 42}); + + result = _(dictionary).chain().all(); + result = _(dictionary).chain().all(dictionaryIterator); + result = _(dictionary).chain().all(dictionaryIterator, any); + result = _(dictionary).chain().all(''); + result = _(dictionary).chain().all<{a: number}>({a: 42}); + } } // _.any @@ -1876,43 +1900,67 @@ module TestEvery { let listIterator: (value: TResult, index: number, collection: _.List) => boolean; let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => boolean; - let result: boolean; + { + let result: boolean; - result = _.every(array); - result = _.every(array, listIterator); - result = _.every(array, listIterator, any); - result = _.every(array, ''); - result = _.every<{a: number}, TResult>(array, {a: 42}); + result = _.every(array); + result = _.every(array, listIterator); + result = _.every(array, listIterator, any); + result = _.every(array, ''); + result = _.every<{a: number}, TResult>(array, {a: 42}); - result = _.every(list); - result = _.every(list, listIterator); - result = _.every(list, listIterator, any); - result = _.every(list, ''); - result = _.every<{a: number}, TResult>(list, {a: 42}); + result = _.every(list); + result = _.every(list, listIterator); + result = _.every(list, listIterator, any); + result = _.every(list, ''); + result = _.every<{a: number}, TResult>(list, {a: 42}); - result = _.every(dictionary); - result = _.every(dictionary, dictionaryIterator); - result = _.every(dictionary, dictionaryIterator, any); - result = _.every(dictionary, ''); - result = _.every<{a: number}, TResult>(dictionary, {a: 42}); + result = _.every(dictionary); + result = _.every(dictionary, dictionaryIterator); + result = _.every(dictionary, dictionaryIterator, any); + result = _.every(dictionary, ''); + result = _.every<{a: number}, TResult>(dictionary, {a: 42}); - result = _(array).every(); - result = _(array).every(listIterator); - result = _(array).every(listIterator, any); - result = _(array).every(''); - result = _(array).every<{a: number}>({a: 42}); + result = _(array).every(); + result = _(array).every(listIterator); + result = _(array).every(listIterator, any); + result = _(array).every(''); + result = _(array).every<{a: number}>({a: 42}); - result = _(list).every(); - result = _(list).every(listIterator); - result = _(list).every(listIterator, any); - result = _(list).every(''); - result = _(list).every<{a: number}>({a: 42}); + result = _(list).every(); + result = _(list).every(listIterator); + result = _(list).every(listIterator, any); + result = _(list).every(''); + result = _(list).every<{a: number}>({a: 42}); - result = _(dictionary).every(); - result = _(dictionary).every(dictionaryIterator); - result = _(dictionary).every(dictionaryIterator, any); - result = _(dictionary).every(''); - result = _(dictionary).every<{a: number}>({a: 42}); + result = _(dictionary).every(); + result = _(dictionary).every(dictionaryIterator); + result = _(dictionary).every(dictionaryIterator, any); + result = _(dictionary).every(''); + result = _(dictionary).every<{a: number}>({a: 42}); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(array).chain().every(); + result = _(array).chain().every(listIterator); + result = _(array).chain().every(listIterator, any); + result = _(array).chain().every(''); + result = _(array).chain().every<{a: number}>({a: 42}); + + result = _(list).chain().every(); + result = _(list).chain().every(listIterator); + result = _(list).chain().every(listIterator, any); + result = _(list).chain().every(''); + result = _(list).chain().every<{a: number}>({a: 42}); + + result = _(dictionary).chain().every(); + result = _(dictionary).chain().every(dictionaryIterator); + result = _(dictionary).chain().every(dictionaryIterator, any); + result = _(dictionary).chain().every(''); + result = _(dictionary).chain().every<{a: number}>({a: 42}); + } } result = _.filter([1, 2, 3, 4, 5, 6]); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index d143f4e65..5b410e7f3 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -2747,6 +2747,56 @@ declare module _ { ): boolean; } + interface LoDashExplicitArrayWrapper { + /** + * @see _.every + */ + all( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.every + */ + all( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.every + */ + all( + predicate?: TObject + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.every + */ + all( + predicate?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.every + */ + all( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.every + */ + all( + predicate?: TObject + ): LoDashExplicitWrapper; + } + //_.any interface LoDashStatic { /** @@ -3404,6 +3454,56 @@ declare module _ { ): boolean; } + interface LoDashExplicitArrayWrapper { + /** + * @see _.every + */ + every( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.every + */ + every( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.every + */ + every( + predicate?: TObject + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.every + */ + every( + predicate?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.every + */ + every( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.every + */ + every( + predicate?: TObject + ): LoDashExplicitWrapper; + } + //_.fill interface LoDashStatic { /**