From 3d77d34ed81d5fbf6013b857a59ae9a168b165cd Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Tue, 26 Jan 2016 04:09:36 +0500 Subject: [PATCH] lodash: _.overEvery and _.overSome added --- lodash/lodash-tests.ts | 60 +++++++++++++++++++++++++++++++ lodash/lodash.d.ts | 80 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 140 insertions(+) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index a7d3a72b88..bfb3c00677 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -9911,6 +9911,66 @@ namespace TestOver { } } +// _.overEvery +namespace TestOverEvery { + { + let result: (...args: any[]) => boolean; + + result = _.overEvery(() => true); + result = _.overEvery(() => true, () => true); + result = _.overEvery([() => true]); + result = _.overEvery([() => true], [() => true]); + } + + { + let result: _.LoDashImplicitObjectWrapper<(...args: any[]) => boolean>; + + result = _(Math.max).overEvery(); + result = _(Math.max).overEvery(() => true); + result = _([Math.max]).overEvery(); + result = _([Math.max]).overEvery([() => true]); + } + + { + let result: _.LoDashExplicitObjectWrapper<(...args: any[]) => boolean>; + + result = _(Math.max).chain().overEvery(); + result = _(Math.max).chain().overEvery(() => true); + result = _([Math.max]).chain().overEvery(); + result = _([Math.max]).chain().overEvery([() => true]); + } +} + +// _.overSome +namespace TestOverSome { + { + let result: (...args: any[]) => boolean; + + result = _.overSome(() => true); + result = _.overSome(() => true, () => true); + result = _.overSome([() => true]); + result = _.overSome([() => true], [() => true]); + } + + { + let result: _.LoDashImplicitObjectWrapper<(...args: any[]) => boolean>; + + result = _(Math.max).overSome(); + result = _(Math.max).overSome(() => true); + result = _([Math.max]).overSome(); + result = _([Math.max]).overSome([() => true]); + } + + { + let result: _.LoDashExplicitObjectWrapper<(...args: any[]) => boolean>; + + result = _(Math.max).chain().overSome(); + result = _(Math.max).chain().overSome(() => true); + result = _([Math.max]).chain().overSome(); + result = _([Math.max]).chain().overSome([() => true]); + } +} + // _.property module TestProperty { interface SampleObject { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index e5f938b546..02190127eb 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -16235,6 +16235,86 @@ declare module _ { over(...iteratees: (Function|Function[])[]): LoDashExplicitObjectWrapper<(...args: any[]) => TResult[]>; } + //_.overEvery + interface LoDashStatic { + /** + * Creates a function that checks if all of the predicates return truthy when invoked with the arguments + * provided to the created function. + * + * @param predicates The predicates to check. + * @return Returns the new function. + */ + overEvery(...predicates: (Function|Function[])[]): (...args: any[]) => boolean; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.overEvery + */ + overEvery(...predicates: (Function|Function[])[]): LoDashImplicitObjectWrapper<(...args: any[]) => boolean>; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.overEvery + */ + overEvery(...predicates: (Function|Function[])[]): LoDashImplicitObjectWrapper<(...args: any[]) => boolean>; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.overEvery + */ + overEvery(...predicates: (Function|Function[])[]): LoDashExplicitObjectWrapper<(...args: any[]) => boolean>; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.overEvery + */ + overEvery(...predicates: (Function|Function[])[]): LoDashExplicitObjectWrapper<(...args: any[]) => boolean>; + } + + //_.overSome + interface LoDashStatic { + /** + * Creates a function that checks if any of the predicates return truthy when invoked with the arguments + * provided to the created function. + * + * @param predicates The predicates to check. + * @return Returns the new function. + */ + overSome(...predicates: (Function|Function[])[]): (...args: any[]) => boolean; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.overSome + */ + overSome(...predicates: (Function|Function[])[]): LoDashImplicitObjectWrapper<(...args: any[]) => boolean>; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.overSome + */ + overSome(...predicates: (Function|Function[])[]): LoDashImplicitObjectWrapper<(...args: any[]) => boolean>; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.overSome + */ + overSome(...predicates: (Function|Function[])[]): LoDashExplicitObjectWrapper<(...args: any[]) => boolean>; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.overSome + */ + overSome(...predicates: (Function|Function[])[]): LoDashExplicitObjectWrapper<(...args: any[]) => boolean>; + } + //_.property interface LoDashStatic { /**