%PDF- %PDF-
Direktori : /proc/self/root/home/infra/BACKUP-FUSIONINVENTORY/lib/lazy.js-0.5.1/experimental/ |
Current File : //proc/self/root/home/infra/BACKUP-FUSIONINVENTORY/lib/lazy.js-0.5.1/experimental/lazy.es6.min.js |
(function(context){var Lazy=context.Lazy;if(typeof Lazy==="undefined"&&typeof require==="function"){Lazy=require("../lazy.js")}if(typeof Symbol!=="undefined"){Lazy.Sequence.prototype[Symbol.iterator]=function(){return new IteratorAdapter(this.getIterator())};function IteratorAdapter(iterator){this.iterator=iterator}IteratorAdapter.prototype.next=function next(){if(this.iterator.moveNext()){return{value:this.iterator.current()}}return{done:true}}}var GeneratorConstructor=function(){try{return eval("(function*() {})").constructor}catch(e){return function(){}}}();function isES6Generator(fn){return fn instanceof GeneratorConstructor}function GeneratorWrapper(generator){this.generator=generator}GeneratorWrapper.prototype=new Lazy.Sequence;GeneratorWrapper.prototype.each=function each(fn){var iterator=this.generator(),result,i=0;while(!(result=iterator.next()).done){if(fn(result.value,i++)===false){return false}}};function isES6Map(object){return context.Map&&object instanceof context.Map}function MapWrapper(map){this.map=map}MapWrapper.prototype=new Lazy.ObjectLikeSequence;MapWrapper.prototype.each=function each(fn){var map=this.map;for(var pair of map){if(fn(pair[1],pair[0])===false){return false}}return true};function isES6Set(object){return context.Set&&object instanceof context.Set}function isES6Iterator(object){return context.Iterator&&object instanceof context.Iterator}function IterableWrapper(iterable){this.iterable=iterable}IterableWrapper.prototype=new Lazy.Sequence;IterableWrapper.prototype.each=function each(fn){var iterable=this.iterable,i=-1;for(var item of iterable){if(fn(item,++i)===false){return false}}return true};Lazy.extensions||(Lazy.extensions=[]);Lazy.extensions.push(function(source){if(isES6Generator(source)){return new GeneratorWrapper(source)}else if(isES6Map(source)){return new MapWrapper(source)}else if(isES6Set(source)||isES6Iterator(source)){return new IterableWrapper(source)}});Lazy.isES6Generator=isES6Generator})(typeof global!=="undefined"?global:this);