Procházet zdrojové kódy

Added support to replace functions with their function lists.

Eugene Lazutkin před 3 roky
rodič
revize
0b6b3da47d
1 změnil soubory, kde provedl 5 přidání a 1 odebrání
  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