]> gerrit.simantics Code Review - simantics/district.git/blob - org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/node_modules/es6-symbol/node_modules/es5-ext/node_modules/es6-iterator/#/chain.js
Adding integrated tile server
[simantics/district.git] / org.simantics.maps.server / node / node-v4.8.0-win-x64 / node_modules / npm / node_modules / node-gyp / node_modules / path-array / node_modules / array-index / node_modules / es6-symbol / node_modules / es5-ext / node_modules / es6-iterator / # / chain.js
1 'use strict';
2
3 var setPrototypeOf = require('es5-ext/object/set-prototype-of')
4   , d              = require('d')
5   , Iterator       = require('../')
6   , validIterable  = require('../valid-iterable')
7
8   , push = Array.prototype.push
9   , defineProperties = Object.defineProperties
10   , IteratorChain;
11
12 IteratorChain = function (iterators) {
13         defineProperties(this, {
14                 __iterators__: d('', iterators),
15                 __current__: d('w', iterators.shift())
16         });
17 };
18 if (setPrototypeOf) setPrototypeOf(IteratorChain, Iterator);
19
20 IteratorChain.prototype = Object.create(Iterator.prototype, {
21         constructor: d(IteratorChain),
22         next: d(function () {
23                 var result;
24                 if (!this.__current__) return { done: true, value: undefined };
25                 result = this.__current__.next();
26                 while (result.done) {
27                         this.__current__ = this.__iterators__.shift();
28                         if (!this.__current__) return { done: true, value: undefined };
29                         result = this.__current__.next();
30                 }
31                 return result;
32         })
33 });
34
35 module.exports = function () {
36         var iterators = [this];
37         push.apply(iterators, arguments);
38         iterators.forEach(validIterable);
39         return new IteratorChain(iterators);
40 };