From e57c630919234111329e5a0b306e281c11fef936 Mon Sep 17 00:00:00 2001 From: rzymek Date: Mon, 26 Jun 2017 18:36:18 +0200 Subject: [PATCH] lodash - Enabled _.flow & _.flowRight to accept an array of functions --- types/lodash/index.d.ts | 23 ++++++++++++++++++++++- types/lodash/lodash-tests.ts | 7 +++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/types/lodash/index.d.ts b/types/lodash/index.d.ts index 6326773899..282a98d789 100644 --- a/types/lodash/index.d.ts +++ b/types/lodash/index.d.ts @@ -189,7 +189,7 @@ Misc: - [ ] _.extendWith as an alias of _.assignInWith - [ ] Added clear method to _.memoize.Cache - [ ] Added support for ES6 maps, sets, & symbols to _.clone, _.isEqual, & _.toArray -- [ ] Enabled _.flow & _.flowRight to accept an array of functions +- [x] Enabled _.flow & _.flowRight to accept an array of functions - [ ] Ensured “Collection” methods treat functions as objects - [ ] Ensured _.assign, _.defaults, & _.merge coerce object values to objects - [ ] Ensured _.bindKey bound functions call object[key] when called with the new operator @@ -10475,6 +10475,7 @@ declare namespace _ { flow(f1: (a1: A1, a2: A2, a3: A3, a4: A4) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7): (a1: A1, a2: A2, a3: A3, a4: A4) => R7; // generic function flow(...funcs: Function[]): TResult; + flow(funcs: Function[]): TResult; } interface LoDashImplicitObjectWrapper { @@ -10482,6 +10483,10 @@ declare namespace _ { * @see _.flow */ flow(...funcs: Function[]): LoDashImplicitObjectWrapper; + /** + * @see _.flow + */ + flow(funcs: Function[]): LoDashImplicitObjectWrapper; } interface LoDashExplicitObjectWrapper { @@ -10489,6 +10494,10 @@ declare namespace _ { * @see _.flow */ flow(...funcs: Function[]): LoDashExplicitObjectWrapper; + /** + * @see _.flow + */ + flow(funcs: Function[]): LoDashExplicitObjectWrapper; } //_.flowRight @@ -10501,6 +10510,10 @@ declare namespace _ { * @return Returns the new function. */ flowRight(...funcs: Function[]): TResult; + /** + * @see _.flowRight + */ + flowRight(funcs: Function[]): TResult; } interface LoDashImplicitObjectWrapper { @@ -10508,6 +10521,10 @@ declare namespace _ { * @see _.flowRight */ flowRight(...funcs: Function[]): LoDashImplicitObjectWrapper; + /** + * @see _.flowRight + */ + flowRight(funcs: Function[]): LoDashImplicitObjectWrapper; } interface LoDashExplicitObjectWrapper { @@ -10515,6 +10532,10 @@ declare namespace _ { * @see _.flowRight */ flowRight(...funcs: Function[]): LoDashExplicitObjectWrapper; + /** + * @see _.flowRight + */ + flowRight(funcs: Function[]): LoDashExplicitObjectWrapper; } diff --git a/types/lodash/lodash-tests.ts b/types/lodash/lodash-tests.ts index b260df8ee5..b504e73288 100644 --- a/types/lodash/lodash-tests.ts +++ b/types/lodash/lodash-tests.ts @@ -5823,6 +5823,7 @@ namespace TestFlow { result = _.flow(Fn2, Fn1, Fn1, Fn1, Fn1, Fn1); result = _.flow(Fn2, Fn1, Fn1, Fn1, Fn1, Fn1, Fn1); result = _.flow(Fn2, Fn1, Fn3, Fn4); + result = _.flow<(m: number, n: number) => number>([Fn2, Fn1, Fn3, Fn4]); } { @@ -5831,6 +5832,7 @@ namespace TestFlow { result = _.flow<(m: number, n: number) => number>(Fn1, Fn2); result = _.flow<(m: number, n: number) => number>(Fn1, Fn1, Fn2); result = _.flow<(m: number, n: number) => number>(Fn1, Fn1, Fn1, Fn2); + result = _.flow<(m: number, n: number) => number>([Fn1, Fn1, Fn1, Fn2]); } { @@ -5839,6 +5841,7 @@ namespace TestFlow { result = _(Fn1).flow<(m: number, n: number) => number>(Fn2); result = _(Fn1).flow<(m: number, n: number) => number>(Fn1, Fn2); result = _(Fn1).flow<(m: number, n: number) => number>(Fn1, Fn1, Fn2); + result = _(Fn1).flow<(m: number, n: number) => number>([Fn1, Fn1, Fn2]); } { @@ -5847,6 +5850,7 @@ namespace TestFlow { result = _(Fn1).chain().flow<(m: number, n: number) => number>(Fn2); result = _(Fn1).chain().flow<(m: number, n: number) => number>(Fn1, Fn2); result = _(Fn1).chain().flow<(m: number, n: number) => number>(Fn1, Fn1, Fn2); + result = _(Fn1).chain().flow<(m: number, n: number) => number>([Fn1, Fn1, Fn2]); } } @@ -5861,6 +5865,7 @@ namespace TestFlowRight { result = _.flowRight<(m: number, n: number) => number>(Fn1, Fn2); result = _.flowRight<(m: number, n: number) => number>(Fn1, Fn1, Fn2); result = _.flowRight<(m: number, n: number) => number>(Fn1, Fn1, Fn1, Fn2); + result = _.flowRight<(m: number, n: number) => number>([Fn1, Fn1, Fn1, Fn2]); } { @@ -5869,6 +5874,7 @@ namespace TestFlowRight { result = _(Fn1).flowRight<(m: number, n: number) => number>(Fn2); result = _(Fn1).flowRight<(m: number, n: number) => number>(Fn1, Fn2); result = _(Fn1).flowRight<(m: number, n: number) => number>(Fn1, Fn1, Fn2); + result = _(Fn1).flowRight<(m: number, n: number) => number>([Fn1, Fn1, Fn2]); } { @@ -5877,6 +5883,7 @@ namespace TestFlowRight { result = _(Fn1).chain().flowRight<(m: number, n: number) => number>(Fn2); result = _(Fn1).chain().flowRight<(m: number, n: number) => number>(Fn1, Fn2); result = _(Fn1).chain().flowRight<(m: number, n: number) => number>(Fn1, Fn1, Fn2); + result = _(Fn1).chain().flowRight<(m: number, n: number) => number>([Fn1, Fn1, Fn2]); } }