Explorar o código

Added support to replace functions with their function lists.

Eugene Lazutkin %!s(int64=3) %!d(string=hai) anos
pai
achega
0b6b3da47d
Modificáronse 1 ficheiros con 5 adicións e 1 borrados
  1. 5 1
      src/index.js

+ 5 - 1
src/index.js

@@ -101,7 +101,11 @@ const chain = (fns, options) => {
     throw TypeError("Chain's first argument should be a non-empty array.");
   }
 
-  fns = fns.filter(fn => fn).flat(Infinity); // remove nulls and flatten
+  fns = fns
+    .filter(fn => fn)
+    .flat(Infinity)
+    .map(fn => (defs.isFunctionList(fn) ? defs.getFunctionList(fn) : fn))
+    .flat(Infinity);
 
   const streams = (
       options && options.noGrouping