Quellcode durchsuchen

Removed support for iterable objects.

Eugene Lazutkin vor 3 Jahren
Ursprung
Commit
e3a13d2c76
1 geänderte Dateien mit 2 neuen und 11 gelöschten Zeilen
  1. 2 11
      src/asStream.js

+ 2 - 11
src/asStream.js

@@ -4,18 +4,9 @@ const {Duplex} = require('stream');
 const defs = require('./defs');
 
 const asStream = (fn, options) => {
-  if (fn && typeof fn != 'function') {
-    if (typeof fn[Symbol.asyncIterator] == 'function') {
-      fn = fn[Symbol.asyncIterator].bind(fn);
-    } else if (typeof fn[Symbol.iterator] == 'function') {
-      fn = fn[Symbol.iterator].bind(fn);
-    } else {
-      fn = null;
-    }
-  }
-  if (!fn)
+  if (typeof fn != 'function')
     throw TypeError(
-      'Only a function or an object with an iterator is accepted as the first argument'
+      'Only a function is accepted as the first argument'
     );
 
   // pump variables