소스 검색

Don't unroll function lists when no grouping.

Eugene Lazutkin 3 년 전
부모
커밋
e0c6d76759
1개의 변경된 파일6개의 추가작업 그리고 6개의 파일을 삭제
  1. 6 6
      src/index.js

+ 6 - 6
src/index.js

@@ -101,16 +101,16 @@ const chain = (fns, options) => {
     throw TypeError("Chain's first argument should be a non-empty array.");
   }
 
-  fns = fns
-    .filter(fn => fn)
-    .flat(Infinity)
-    .map(fn => (defs.isFunctionList(fn) ? defs.getFunctionList(fn) : fn))
-    .flat(Infinity);
+  fns = fns.filter(fn => fn).flat(Infinity);
 
   const streams = (
       options && options.noGrouping
         ? fns.map(wrapFunctions)
-        : fns.reduce(groupFunctions, []).map(produceStreams)
+        : fns
+            .map(fn => (defs.isFunctionList(fn) ? defs.getFunctionList(fn) : fn))
+            .flat(Infinity)
+            .reduce(groupFunctions, [])
+            .map(produceStreams)
     ).filter(s => s),
     input = streams[0],
     output = streams.reduce((output, item) => (output && output.pipe(item)) || item);