Merge pull request #17501 from rzymek/lodash.flow

lodash - Enabled _.flow & _.flowRight to accept an array of functions
This commit is contained in:
Paul van Brenk
2017-06-26 16:25:03 -07:00
committed by GitHub
2 changed files with 29 additions and 1 deletions
+22 -1
View File
@@ -187,7 +187,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
@@ -10799,6 +10799,7 @@ declare namespace _ {
flow<A1, A2, A3, A4, R1, R2, R3, R4, R5, R6, R7>(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<TResult extends Function>(...funcs: Function[]): TResult;
flow<TResult extends Function>(funcs: Function[]): TResult;
}
interface LoDashImplicitObjectWrapper<T> {
@@ -10806,6 +10807,10 @@ declare namespace _ {
* @see _.flow
*/
flow<TResult extends Function>(...funcs: Function[]): LoDashImplicitObjectWrapper<TResult>;
/**
* @see _.flow
*/
flow<TResult extends Function>(funcs: Function[]): LoDashImplicitObjectWrapper<TResult>;
}
interface LoDashExplicitObjectWrapper<T> {
@@ -10813,6 +10818,10 @@ declare namespace _ {
* @see _.flow
*/
flow<TResult extends Function>(...funcs: Function[]): LoDashExplicitObjectWrapper<TResult>;
/**
* @see _.flow
*/
flow<TResult extends Function>(funcs: Function[]): LoDashExplicitObjectWrapper<TResult>;
}
//_.flowRight
@@ -10825,6 +10834,10 @@ declare namespace _ {
* @return Returns the new function.
*/
flowRight<TResult extends Function>(...funcs: Function[]): TResult;
/**
* @see _.flowRight
*/
flowRight<TResult extends Function>(funcs: Function[]): TResult;
}
interface LoDashImplicitObjectWrapper<T> {
@@ -10832,6 +10845,10 @@ declare namespace _ {
* @see _.flowRight
*/
flowRight<TResult extends Function>(...funcs: Function[]): LoDashImplicitObjectWrapper<TResult>;
/**
* @see _.flowRight
*/
flowRight<TResult extends Function>(funcs: Function[]): LoDashImplicitObjectWrapper<TResult>;
}
interface LoDashExplicitObjectWrapper<T> {
@@ -10839,6 +10856,10 @@ declare namespace _ {
* @see _.flowRight
*/
flowRight<TResult extends Function>(...funcs: Function[]): LoDashExplicitObjectWrapper<TResult>;
/**
* @see _.flowRight
*/
flowRight<TResult extends Function>(funcs: Function[]): LoDashExplicitObjectWrapper<TResult>;
}
//_.memoize
+7
View File
@@ -6090,6 +6090,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]);
}
{
@@ -6098,6 +6099,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]);
}
{
@@ -6106,6 +6108,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]);
}
{
@@ -6114,6 +6117,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]);
}
}
@@ -6128,6 +6132,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]);
}
{
@@ -6136,6 +6141,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]);
}
{
@@ -6144,6 +6150,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]);
}
}