iwmlib/lib/3rdparty/systemjs/babel-helpers/asyncIterator.js

14 lines
360 B
JavaScript
Raw Permalink Normal View History

2019-04-05 10:09:27 +02:00
export default (function (iterable) {
if (typeof Symbol === "function") {
if (Symbol.asyncIterator) {
var method = iterable[Symbol.asyncIterator];
if (method != null) return method.call(iterable);
}
if (Symbol.iterator) {
return iterable[Symbol.iterator]();
}
}
throw new TypeError("Object is not async iterable");
});