This repository has been archived by the owner on Apr 20, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
/
ix.min.js
1 lines (1 loc) · 10.8 KB
/
ix.min.js
1
!function(a,b){var c="object"==typeof exports&&exports&&("object"==typeof a&&a&&a==a.global&&(window=a),exports);"function"==typeof define&&define.amd?define(["Ix","exports"],function(c,d){return a.Ix=b(a,d,c),a.Ix}):"object"==typeof module&&module&&module.exports==c?module.exports=b(a,module.exports,require("./l2o")):a.Ix=b(a,{},a.Ix)}(this,function(a,b,c,d){function e(){}function f(a){return a}function g(a,b){return a>b?1:b>a?-1:0}function h(a,b){return q(a,b)}function i(a,b){b||(b=h);for(var c=0,d=this.length;d>c;c++)if(b(a,this[c]))return c;return-1}function j(a,b,c){var d=[],e=a.getEnumerator();try{if(!e.moveNext())throw new Error(r);var f=e.getCurrent(),g=b(f);for(d.push(f);e.moveNext();){var h=e.getCurrent(),i=b(h),j=c(i,g);0===j?d.push(h):j>0&&(d=[h],g=i)}}finally{e.dispose()}return x(d)}function k(a){this.readerCount=a,this.list={},this.length=0}function l(){this.list=[],this.length=0}function m(a,b){return function(){a.apply(b,arguments)}}function n(a,b){var c=this;return new t(function(){var d,e,f=a;return z(function(){if(e||(e=c.getEnumerator()),!e.moveNext())return!1;var a=e.getCurrent();return f=b(f,a),d=f,!0},function(){return d},function(){e&&e.dispose()})})}function o(a){var b=this;return new t(function(){var c,d,e,f=!1;return z(function(){for(d||(d=b.getEnumerator());;){if(!d.moveNext())return!1;var g=d.getCurrent();{if(f)return e=a(e,g),c=e,!0;f=!0,e=g}}},function(){return c},function(){d&&d.dispose()})})}function p(a,b){return new t(function(){var c,d,e;return z(function(){for(g||(g=a.getEnumerator());;){var d,f;try{d=g.moveNext(),f=g.getCurrent()}catch(g){e=b(g);break}return d?(c=f,!0):!1}return e?(g.dispose(),g=e.getEnumerator(),g.moveNext()?(c=g.getCurrent(),!0):!1):void 0},function(){return c},function(){d&&d.dispose()})})}var q=c.Internals.isEqual,r="Sequence contains no elements.",s=Array.prototype.slice,t=c.Enumerable,u=t.prototype,v=t.concat,w=t.empty,x=t.fromArray,y=t.repeat,z=c.Enumerator.create;inherits=c.Internals.inherits,u.isEmpty=function(){return!this.any()},u.minBy=function(a,b){return b||(b=g),j(this,a,function(a,c){return-b(a,c)})},u.maxBy=function(a,b){return b||(b=g),j(this,a,b)};var A=function(){function a(a){this.disposed=!1,this.source=a}return inherits(a,t),a.prototype.getEnumerator=function(){if(this.disposed)throw new Error("Object disposed");var a,b=this;return z(function(){return b.source.moveNext()?(a=b.source.getCurrent(),!0):!1},function(){return a})},a.prototype.dispose=function(){this.disposed||(this.disposed=!0,this.source.dispose(),this.source=null)},a}();u.share=function(a){var b=this;return a?new t(function(){return a(b.share()).getEnumerator()}):new A(b.getEnumerator())};var B=k.prototype;B.clear=function(){this.list={},this.length=0},B.get=function(a){if(!this.list[a])throw new Error("Element no longer available in the buffer.");var b=this.list[a];return 0===--b.length&&delete this.list[a],b.value},B.push=function(a){this.list[this.length]={value:a,length:this.readerCount},this.length++},B.done=function(a){for(var b=a;b<this.length;b++)this.get(b);this.readerCount--};var C=function(){function a(a){this.source=a,this.buffer=new k(0),this.disposed=!1,this.stopped=!1,this.error=null}function b(a){var b,c=this,d=!1,e=!0,f=!1;return z(function(){if(c.disposed)throw new Error("Object disposed");e||a++;var g,h=!1;if(a>=c.buffer.length){if(!c.stopped)try{h=c.source.moveNext(),h&&(g=c.source.getCurrent())}catch(i){c.stopped=!0,c.error=i,c.source.dispose(),d=!0}if(c.stopped){if(c.error)throw c.buffer&&c.buffer.done(a+1),f=!0,c.error;return c.buffer&&c.buffer.done(a+1),f=!0,!1}h&&c.buffer.push(g)}else h=!0;return h?(b=c.buffer.get(a),e=!1,!0):(c.buffer&&c.buffer.done(a+1),f=!0,!1)},function(){return b},function(){f&&c.buffer&&c.buffer.done(a)})}return inherits(a,t),a.prototype.getEnumerator=function(){if(this.disposed)throw new Error("Object disposed");var a=this.buffer.length;return this.buffer.readerCount++,b.call(this,a)},a.prototype.dispose=function(){this.disposed||(this.source.dispose(),this.source=null,this.buffer.clear(),this.buffer=null,this.disposed=!0)},a}();u.publish=function(a){var b=this;return a?new t(function(){return a(b.publish()).getEnumerator()}):new C(b.getEnumerator())};var D=l.prototype;D.done=e,D.push=function(a){this.list[this.length++]=a},D.clear=function(){this.list=[],this.length=0},D.get=function(a){return this.list[a]};var E=function(){function a(a,b){this.source=a,this.buffer=b,this.stopped=!1,this.error=null,this.disposed=!1}return inherits(a,t),a.prototype.getEnumerator=function(){if(this.disposed)throw new Error("Object disposed");var a,b=0,c=this,d=!1,e=!0,f=!1;return z(function(){if(c.disposed)throw new Error("Object disposed");e||b++;var g,h=!1;if(b>=c.buffer.length){if(!c.stopped)try{h=c.source.moveNext(),h&&(g=c.source.getCurrent())}catch(i){c.stopped=!0,c.error=i,c.source.dispose(),d=!0}if(c.stopped){if(c.error)throw c.buffer&&c.buffer.done(b+1),f=!0,c.error;return c.buffer&&c.buffer.done(b+1),f=!0,!1}h&&c.buffer.push(g)}else h=!0;return h?(a=c.buffer.get(b),e=!1,!0):(c.buffer&&c.buffer.done(b+1),f=!0,!1)},function(){return a},function(){f&&c.buffer&&c.buffer.done(b)})},a.prototype.dispose=function(){this.disposed||(this.source.dispose(),this.source=null,this.buffer.clear(),this.buffer=null,this.disposed=!0)},a}();u.memoize=function(){var a=this;return 0===arguments.length?new E(a.getEnumerator(),new l):1===arguments.length&&"function"==typeof arguments[0]?new t(function(){return arguments[1](a.memoize()).getEnumerator()}):1===arguments.length&&"number"==typeof arguments[0]?new E(a.getEnumerator(),new k(arguments[0])):new t(function(){return arguments[1](a.memoize(arguments[0])).getEnumerator()})},t["throw"]=t.throwException=function(a){return new t(function(){return z(function(){throw a},e)})};var F=t.defer=function(a){return new t(function(){var b;return z(function(){return b||(b=a().getEnumerator()),b.moveNext()},function(){return b.getCurrent()},function(){b.dispose()})})};t.generate=function(a,b,c,d){return new t(function(){var e,f,g=!1;return z(function(){if(g){if(e=c(e),!b(e))return!1}else e=a,g=!0;return f=d(e),!0},function(){return f})})},t.using=function(a,b){return new t(function(){var c,d,e,f=!0;return z(function(){return f&&(e=a(),d=b(e).getEnumerator(),f=!1),d.moveNext()?(c=d.getCurrent(),!0):!1},function(){return c},function(){d&&d.dispose(),e&&e.dispose()})})},u["do"]=u.doAction=function(a,b,c){var d,f,g,h=this;return"object"==typeof a?(d=m(a.onNext,a),f=m(a.onError,a),g=m(a.onCompleted,a)):(d=a,f=b||e,g=c||e),new t(function(){var a,b;return z(function(){a||(a=h.getEnumerator());try{if(!a.moveNext())return g(),!1;b=a.getCurrent()}catch(a){throw f(a),a}return d(b),!0},function(){return b},function(){a&&a.dispose()})})},u.bufferWithCount=function(a,b){var c=this;return null==b&&(b=a),new t(function(){var d,e,f=[],g=0;return z(function(){for(d||(d=c.getEnumerator());;){if(!d.moveNext())return f.length>0?(e=t.fromArray(f.shift()),!0):!1;g%b===0&&f.push([]);for(var h=0,i=f.length;i>h;h++)f[h].push(d.getCurrent());if(f.length>0&&f[0].length===a)return e=t.fromArray(f.shift()),++g,!0;++g}},function(){return e},function(){d.dispose()})})},u.ignoreElements=function(){var a=this;return new t(function(){var b;return z(function(){for(b=a.getEnumerator();b.moveNext(););return!1},function(){throw new Error("Operation is not valid due to the current state of the object.")},function(){b.dispose()})})},u.distinctBy=function(a,b){b||(b=h);var c=this;return new t(function(){var d,e,f=[];return z(function(){for(e||(e=c.getEnumerator());;){if(!e.moveNext())return!1;var g=e.getCurrent(),h=a(g);if(-1===i.call(f,h,b))return f.push(g),d=g,!0}},function(){return d},function(){e&&e.dispose()})})},u.distinctUntilChanged=function(a,b){a||(a=f),b||(b=h);var c=this;return new t(function(){var d,e,f,g;return z(function(){for(e||(e=c.getEnumerator());;){if(!e.moveNext())return!1;var h=e.getCurrent(),i=a(h),j=!1;if(g&&(j=b(f,i)),!g||!j)return d=h,f=i,g=!0,!0}},function(){return d},function(){e&&e.dispose()})})},u.expand=function(a){var b=this;return new t(function(){var c,d,e=[b];return z(function(){for(;;){if(!d){if(0===e.length)return!1;d=e.shift().getEnumerator()}if(d.moveNext())return c=d.getCurrent(),e.push(a(c)),!0;d.dispose(),d=null}},function(){return c},function(){d&&d.dispose()})})},u.startWith=function(){return v(x(s.call(arguments)),this)},u.scan=function(){var a=1===arguments.length?o:n;return a.apply(this,arguments)},u.takeLast=function(a){var b=this;return new t(function(){var c,d,e;return z(function(){if(d||(d=b.getEnumerator()),!e)for(e=[];d.moveNext();)e.push(d.getCurrent()),e.length>a&&e.shift();return 0===e.length?!1:(c=e.shift(),!0)},function(){return c},function(){d&&d.dispose()})})},u.skipLast=function(a){var b=this;return new t(function(){var c,d,e=[];return z(function(){for(d||(d=b.getEnumerator());;){if(!d.moveNext())return!1;if(e.push(d.getCurrent()),e.length>a)return c=e.shift(),!0}},function(){return c},function(){d&&d.dispose()})})},u.repeat=function(a){var b=this;return y(0,a).selectMany(function(){return b})},u["catch"]=u.catchException=function(a){if(0===arguments.length)return G(this);if("function"==typeof a)return p(this,a);var b=s.call(arguments);return b.unshift(this),G.apply(null,b)};var G=t["catch"]=t.catchException=function(){var a=t.fromArray(arguments);return new t(function(){var b,c,d,e;return z(function(){for(b||(b=a.getEnumerator());;){for(;;){if(!c){if(!b.moveNext()){if(e)throw e;return!1}e=null,c=b.getCurrent().getEnumerator()}var f,g;try{f=c.moveNext(),g=c.getCurrent()}catch(h){e=h,c.dispose(),c=null;break}if(!f){c.dispose(),c=null;break}return d=g,!0}if(null==e)break}},function(){return d},function(){c&&c.dispose(),b&&b.dispose()})})};u["finally"]=u.finallyDo=function(a){var b=this;return new t(function(){var c,d=!1;return z(function(){e||(e=b.getEnumerator());var c;try{return c=e.moveNext(),c?c:(a(),d=!0,!1)}catch(e){throw a(),d=!0,e}},function(){return c.getCurrent()},function(){!d&&a(),c&&c.dispose()})})},u.onErrorResumeNext=function(a){return H.apply(null,[this,a])};var H=t.onErrorResumeNext=function(){var a=arguments;return new t(function(){var b,c,d=0;return z(function(){for(;d<a.length;){c||(c=a[d].getEnumerator());try{var e=c.moveNext();if(e)return b=c.getCurrent(),!0}catch(f){}c.dispose(),c=null,d++}return!1},function(){return b},function(){c&&c.dispose()})})};u.retry=function(a){var b=this;return new t(function(){var c,d,e=a,f=null!=a;return z(function(){for(d||(d=b.getEnumerator());;)try{return d.moveNext()?(c=d.getCurrent(),!0):!1}catch(a){if(f&&0===--e)throw a;d=b.getEnumerator(),error=null}},function(){return c},function(){d.dispose()})})};var I=t["while"]=t.whileDo=function(a,b){return y(b).takeWhile(a).selectMany(f)};return t["if"]=t.ifThen=function(a,b,c){return c||(c=w()),F(function(){return a()?b:c})},t.doWhile=function(a,b){return a.concat(I(b,a))},t["case"]=t.switchCase=function(a,b,c){return c||(c=w()),F(function(){var d=b[a()];return d||(d=c),d})},t["for"]=t.forIn=function(a,b){return a.select(b)},c});