Pārlūkot izejas kodu

Added support to replace functions with their function lists.

Eugene Lazutkin 3 gadi atpakaļ
vecāks
revīzija
0b6b3da47d
1 mainītis faili ar 5 papildinājumiem un 1 dzēšanām
  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