frontend/.pnpm-store/v3/files/77/8d3e3ce2d07aa170bb606f07e0f97df8bed17487fb7e2a85ded1c996dddb9f7886cf9cf448ac7d820d4d1d912697e1ee4dd2a4cb28b5c90ed00891a0e49dcb

41 lines
1.1 KiB
Plaintext

"use strict";
var setPrototypeOf = require("es5-ext/object/set-prototype-of")
, d = require("d")
, Iterator = require("../")
, validIterable = require("../valid-iterable")
, push = Array.prototype.push
, defineProperties = Object.defineProperties
, IteratorChain;
IteratorChain = function (iterators) {
defineProperties(this, {
__iterators__: d("", iterators),
__current__: d("w", iterators.shift())
});
};
if (setPrototypeOf) setPrototypeOf(IteratorChain, Iterator);
IteratorChain.prototype = Object.create(Iterator.prototype, {
constructor: d(IteratorChain),
next: d(function () {
var result;
if (!this.__current__) return { done: true, value: undefined };
result = this.__current__.next();
while (result.done) {
this.__current__ = this.__iterators__.shift();
if (!this.__current__) return { done: true, value: undefined };
result = this.__current__.next();
}
return result;
})
});
module.exports = function () {
var iterators = [this];
push.apply(iterators, arguments);
iterators.forEach(validIterable);
return new IteratorChain(iterators);
};