Quellcode durchsuchen

Removed unnecessary comment + minor refactoring.

Eugene Lazutkin vor 3 Jahren
Ursprung
Commit
62af2bae4e
2 geänderte Dateien mit 3 neuen und 4 gelöschten Zeilen
  1. 0 1
      src/fun.js
  2. 3 3
      src/gen.js

+ 0 - 1
src/fun.js

@@ -122,7 +122,6 @@ const fun = (...fns) => {
 
 module.exports = fun;
 
-// to keep ESM happy
 module.exports.next = next;
 module.exports.collect = collect;
 module.exports.asArray = asArray;

+ 3 - 3
src/gen.js

@@ -56,7 +56,7 @@ const gen = (...fns) => {
     fns = [x => x];
   }
   let flushed = false;
-  const g = async function* (value) {
+  let g = async function* (value) {
     if (flushed) throw Error('Call to a flushed pipe.');
     if (value !== defs.none) {
       yield* next(value, fns, 0);
@@ -71,10 +71,10 @@ const gen = (...fns) => {
     }
   };
   const needToFlush = fns.some(fn => fn[defs.flushSymbol] === 1);
-  return needToFlush ? defs.flushable(g) : g;
+  if (needToFlush) g = defs.flushable(g);
+  return g;
 };
 
 module.exports = gen;
 
-// to keep ESM happy
 module.exports.next = next;