Comparing version 0.4.6 to 0.4.7
{ | ||
"name": "baconjs", | ||
"version": "0.4.6", | ||
"version": "0.4.7", | ||
"main": "dist/Bacon.js" | ||
} |
{ | ||
"name": "baconjs", | ||
"version": "0.4.6", | ||
"version": "0.4.7", | ||
"main": "dist/Bacon.js", | ||
@@ -5,0 +5,0 @@ "repo": "raimohanska/bacon.js", |
@@ -117,4 +117,6 @@ (function() { | ||
return value; | ||
} else if (index === values.length) { | ||
return [value, end()]; | ||
} else { | ||
return [value, end()]; | ||
return end(); | ||
} | ||
@@ -836,3 +838,5 @@ }); | ||
} else { | ||
this.push(event); | ||
if (count === 0) { | ||
this.push(event); | ||
} | ||
this.push(end()); | ||
@@ -839,0 +843,0 @@ return Bacon.noMore; |
@@ -1,1 +0,1 @@ | ||
!function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q=[].slice,R={}.hasOwnProperty,S=function(a,b){function c(){this.constructor=a}for(var d in b)R.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},T=function(a,b){return function(){return a.apply(b,arguments)}};"undefined"!=typeof module&&null!==module?(module.exports=a={},a.Bacon=a):("function"==typeof require&&null!=require.amd&&define("bacon",[],function(){return a}),this.Bacon=a={}),a.fromBinder=function(b,c){return null==c&&(c=M.id),new g(function(d){var e;return e=b(function(){var b,g,h,i,j,k,l;for(b=1<=arguments.length?Q.call(arguments,0):[],i=c.apply(null,b),i instanceof Array&&M.last(i)instanceof f||(i=[i]),l=[],j=0,k=i.length;k>j;j++)g=i[j],h=d(g=H(g)),h===a.noMore||g.isEnd()?null!=e?l.push(e()):l.push(a.scheduler.setTimeout(function(){return e()},0)):l.push(void 0);return l})})},a.$={asEventStream:function(b,c,d){var e,f=this;return w(c)&&(e=[c,null],d=e[0],c=e[1]),a.fromBinder(function(a){return f.on(b,c,a),function(){return f.off(b,c,a)}},d)}},null!=(N="undefined"!=typeof jQuery&&null!==jQuery?jQuery:"undefined"!=typeof Zepto&&null!==Zepto?Zepto:null)&&(N.fn.asEventStream=a.$.asEventStream),a.fromEventTarget=function(b,c,d){var e,f,g,h,i,j;return e=null!=(g=b.addEventListener)?g:null!=(h=b.addListener)?h:b.bind,f=null!=(i=b.removeEventListener)?i:null!=(j=b.removeListener)?j:b.unbind,a.fromBinder(function(a){return e.call(b,c,a),function(){return f.call(b,c,a)}},d)},a.fromPromise=function(b,c){return a.fromBinder(function(a){return b.then(a,function(b){return a(new e(b))}),function(){return c?"function"==typeof b.abort?b.abort():void 0:void 0}},function(a){return[a,r()]})},a.noMore=["<no-more>"],a.more=["<more>"],a.later=function(b,c){return a.sequentially(b,[c])},a.sequentially=function(b,c){var d;return d=0,a.fromPoll(b,function(){var a;return a=c[d++],d<c.length?a:[a,r()]})},a.repeatedly=function(b,c){var d;return d=0,a.fromPoll(b,function(){return c[d++%c.length]})},y=function(b){return function(){var c,d,e;return d=arguments[0],c=2<=arguments.length?Q.call(arguments,1):[],e=E(b,[function(a,b){return d.apply(null,Q.call(a).concat([b]))}]),a.combineAsArray(c).flatMap(e)}},a.fromCallback=y(function(){var b,c;return c=arguments[0],b=2<=arguments.length?Q.call(arguments,1):[],a.fromBinder(function(a){return z(c,b)(a),D},function(a){return[a,r()]})}),a.fromNodeCallback=y(function(){var b,c;return c=arguments[0],b=2<=arguments.length?Q.call(arguments,1):[],a.fromBinder(function(a){return z(c,b)(a),D},function(a,b){return a?[new e(a),r()]:[b,r()]})}),a.fromPoll=function(b,c){return a.fromBinder(function(c){var d;return d=a.scheduler.setInterval(c,b),function(){return a.scheduler.clearInterval(d)}},c)},a.interval=function(b,c){return null==c&&(c={}),a.fromPoll(b,function(){return C(c)})},a.constant=function(a){return new l(F([a],u),!0)},a.never=function(){return a.fromArray([])},a.once=function(b){return a.fromArray([b])},a.fromArray=function(a){return new g(F(a,H))},F=function(a,b){return function(c){var d,e,f;for(e=0,f=a.length;f>e;e++)d=a[e],c(b(d));return c(r()),D}},a.mergeAll=function(){var a,b,c,d,e,f,g;for(d=arguments[0],a=2<=arguments.length?Q.call(arguments,1):[],d instanceof Array||(d=[d].concat(a)),c=M.head(d),g=M.tail(d),e=0,f=g.length;f>e;e++)b=g[e],c=c.merge(b);return c},a.zipAsArray=function(){var b,c;return c=arguments[0],b=2<=arguments.length?Q.call(arguments,1):[],c instanceof Array||(c=[c].concat(b)),a.zipWith(c,Array)},a.zipWith=function(){var b,c,d,e;return e=arguments[0],b=arguments[1],d=3<=arguments.length?Q.call(arguments,2):[],w(e)&&(c=e,e=[b].concat(d),b=c),new g(function(c){var d,f,g,h,i,j,k,l,m,n;for(d=function(){var a,b,c;for(c=[],a=0,b=e.length;b>a;a++)h=e[a],c.push([]);return c}(),k=!1,j=function(){var a,b,c;for(c=[],a=0,b=e.length;b>a;a++)h=e[a],c.push(D);return c}(),i=function(){var a,c;for(a=0,c=j.length;c>a;a++)b=j[a],b();return k=!0},l=function(b){var d;return d=c(b),(d===a.noMore||b.isEnd())&&i(),d},f=function(c){return function(e){var f,g,h;return e.isError()?l(e):e.isInitial()?a.more:(d[c].push(e),!e.isEnd()&&M.all(function(){var a,b,c;for(c=[],a=0,b=d.length;b>a;a++)f=d[a],c.push(f.length);return c}())&&(h=function(){var a,b,c;for(c=[],a=0,b=d.length;b>a;a++)f=d[a],c.push(f.shift().value());return c}(),g=l(e.apply(M.always(b.apply(null,h))))),M.any(function(){var a,b,c;for(c=[],a=0,b=d.length;b>a;a++)f=d[a],c.push(f.length&&f[0].isEnd());return c}())&&(g=l(r())),g||a.more)}},g=m=0,n=e.length;n>m;g=++m)h=e[g],j[g]=function(a){return k?void 0:h.subscribe(f(a))}(g);return i})},a.combineAsArray=function(){var b,c,d,e;return d=arguments[0],b=2<=arguments.length?Q.call(arguments,1):[],d instanceof Array||(d=[d].concat(b)),d.length?(e=function(){var a,b,e;for(e=[],a=0,b=d.length;b>a;a++)c=d[a],e.push(j);return e}(),new l(function(b){var f,g,h,i,j,l,m,n,p,q,s,t;for(q=!1,p=function(){var a,b,e;for(e=[],a=0,b=d.length;b>a;a++)c=d[a],e.push(D);return e}(),n=function(){var a,b,c;for(b=0,c=p.length;c>b;b++)a=p[b],a();return q=!0},h=function(){var a,b,e;for(e=[],a=0,b=d.length;b>a;a++)c=d[a],e.push(!1);return e}(),f=function(){var c;return M.all(h)?(c=b(r()),c===a.noMore&&n(),c):void 0},j=!1,g=function(c,d){return function(g){var h,i;return g.isEnd()?(c(),f(),a.noMore):g.isError()?(h=b(g),h===a.noMore&&n(),h):(d(g.value),M.all(M.map(function(a){return a.isDefined},e))?j&&g.isInitial()?a.more:(j=!0,i=function(){var a,b,c,d;for(d=[],b=0,c=e.length;c>b;b++)a=e[b],d.push(a.get()());return d},h=b(g.apply(i)),h===a.noMore&&n(),h):a.more)}},l=function(a){return g(function(){return h[a]=!0},function(b){return e[a]=new o(b)})},i=s=0,t=d.length;t>s;i=++s)m=d[i],m instanceof k||(m=a.constant(m)),q||(p[i]=m.subscribeInternal(l(i)));return n})):a.constant([])},a.onValues=function(){var b,c,d;return c=2<=arguments.length?Q.call(arguments,0,d=arguments.length-1):(d=0,[]),b=arguments[d++],a.combineAsArray(c).onValues(b)},a.combineWith=function(){var b,c;return b=arguments[0],c=2<=arguments.length?Q.call(arguments,1):[],a.combineAsArray(c).map(function(a){return b.apply(null,a)})},a.combineTemplate=function(b){var c,d,e,f,g,h,i,j,l,m;return i=[],m=[],h=function(a){return a[a.length-1]},l=function(a,b,c){return h(a)[b]=c},c=function(a,b){return function(c,d){return l(c,a,d[b])}},g=function(a,b){return function(c){return l(c,a,b)}},j=function(a){return a instanceof Array?[]:{}},e=function(a,b){var d,e;return b instanceof k?(m.push(b),i.push(c(a,m.length-1))):b===Object(b)&&"function"!=typeof b?(e=function(a){return function(c){var d;return d=j(b),l(c,a,d),c.push(d)}},d=function(a){return a.pop()},i.push(e(a)),f(b),i.push(d)):i.push(g(a,b))},f=function(a){return M.each(a,e)},f(b),d=function(a){var c,d,e,f,g;for(e=j(b),c=[e],f=0,g=i.length;g>f;f++)d=i[f],d(c,a);return e},a.combineAsArray(m).map(d)},f=function(){function a(){}return a.prototype.isEvent=function(){return!0},a.prototype.isEnd=function(){return!1},a.prototype.isInitial=function(){return!1},a.prototype.isNext=function(){return!1},a.prototype.isError=function(){return!1},a.prototype.hasValue=function(){return!1},a.prototype.filter=function(){return!0},a.prototype.onDone=function(a){return a()},a}(),i=function(a){function b(a){var b=this;this.value=w(a)?function(){var c;return c=a(),b.value=M.always(c),c}:M.always(a)}return S(b,a),b.prototype.isNext=function(){return!0},b.prototype.hasValue=function(){return!0},b.prototype.fmap=function(a){var b=this;return this.apply(function(){return a(b.value())})},b.prototype.apply=function(a){return new b(a)},b.prototype.filter=function(a){return a(this.value())},b.prototype.describe=function(){return this.value()},b}(f),h=function(a){function b(){return O=b.__super__.constructor.apply(this,arguments)}return S(b,a),b.prototype.isInitial=function(){return!0},b.prototype.isNext=function(){return!1},b.prototype.apply=function(a){return new b(a)},b.prototype.toNext=function(){return new i(this.value)},b}(i),d=function(a){function b(){return P=b.__super__.constructor.apply(this,arguments)}return S(b,a),b.prototype.isEnd=function(){return!0},b.prototype.fmap=function(){return this},b.prototype.apply=function(){return this},b.prototype.describe=function(){return"<end>"},b}(f),e=function(a){function b(a){this.error=a}return S(b,a),b.prototype.isError=function(){return!0},b.prototype.fmap=function(){return this},b.prototype.apply=function(){return this},b.prototype.describe=function(){return"<error> "+this.error},b}(f),k=function(){function b(){this.combine=T(this.combine,this),this.flatMapLatest=T(this.flatMapLatest,this),this.fold=T(this.fold,this),this.scan=T(this.scan,this),this.takeUntil=T(this.takeUntil,this),this.assign=this.onValue}return b.prototype.onValue=function(){var a,b;return b=arguments[0],a=2<=arguments.length?Q.call(arguments,1):[],b=z(b,a),this.subscribe(function(a){return a.hasValue()?b(a.value()):void 0})},b.prototype.onValues=function(a){return this.onValue(function(b){return a.apply(null,b)})},b.prototype.onError=function(){var a,b;return b=arguments[0],a=2<=arguments.length?Q.call(arguments,1):[],b=z(b,a),this.subscribe(function(a){return a.isError()?b(a.error):void 0})},b.prototype.onEnd=function(){var a,b;return b=arguments[0],a=2<=arguments.length?Q.call(arguments,1):[],b=z(b,a),this.subscribe(function(a){return a.isEnd()?b():void 0})},b.prototype.errors=function(){return this.filter(function(){return!1})},b.prototype.filter=function(){var b,c;return c=arguments[0],b=2<=arguments.length?Q.call(arguments,1):[],c instanceof l?c.sampledBy(this,function(a,b){return[a,b]}).filter(function(a){var b,c;return b=a[0],c=a[1],b}).map(function(a){var b,c;return b=a[0],c=a[1]}):(c=z(c,b),this.withHandler(function(b){return b.filter(c)?this.push(b):a.more}))},b.prototype.takeWhile=function(){var b,c;return c=arguments[0],b=2<=arguments.length?Q.call(arguments,1):[],c=z(c,b),this.withHandler(function(b){return b.filter(c)?this.push(b):(this.push(r()),a.noMore)})},b.prototype.endOnError=function(){return this.withHandler(function(a){return a.isError()?(this.push(a),this.push(r())):this.push(a)})},b.prototype.take=function(b){return 0>=b?a.never():this.withHandler(function(c){return c.hasValue()?(b--,b>0?this.push(c):(this.push(c),this.push(r()),a.noMore)):this.push(c)})},b.prototype.map=function(){var a,b;return b=arguments[0],a=2<=arguments.length?Q.call(arguments,1):[],b=z(b,a),this.withHandler(function(a){return this.push(a.fmap(b))})},b.prototype.mapError=function(){var a,b;return b=arguments[0],a=2<=arguments.length?Q.call(arguments,1):[],b=z(b,a),this.withHandler(function(a){return a.isError()?this.push(C(b(a.error))):this.push(a)})},b.prototype.mapEnd=function(){var b,c;return c=arguments[0],b=2<=arguments.length?Q.call(arguments,1):[],c=z(c,b),this.withHandler(function(b){return b.isEnd()?(this.push(C(c(b))),this.push(r()),a.noMore):this.push(b)})},b.prototype.doAction=function(){var a,b;return b=arguments[0],a=2<=arguments.length?Q.call(arguments,1):[],b=z(b,a),this.withHandler(function(a){return a.hasValue()&&b(a.value()),this.push(a)})},b.prototype.takeUntil=function(b){var c;return c=this,this.withSubscribe(function(d){var e,f,g,h,i,j;return j=!1,h=D,i=D,g=function(){return h(),i(),j=!0},e=function(b){return b.isEnd()?(i(),d(b),a.noMore):(b.onDone(function(){var c;return j||(c=d(b),c!==a.noMore)?void 0:g()}),a.more)},f=function(b){return b.isError()?a.more:b.isEnd()?a.noMore:(h(),d(r()),a.noMore)},h=c.subscribe(e),j||(i=b.subscribe(f)),g})},b.prototype.skip=function(b){return this.withHandler(function(c){return c.hasValue()?b>0?(b--,a.more):this.push(c):this.push(c)})},b.prototype.skipDuplicates=function(a){return null==a&&(a=function(a,b){return a===b}),this.withStateMachine(j,function(b,c){return c.hasValue()?b!==j&&a(b.get(),c.value())?[b,[]]:[new o(c.value()),[c]]:[b,[c]]})},b.prototype.withStateMachine=function(b,c){var d;return d=b,this.withHandler(function(b){var e,f,g,h,i,j,k;for(e=c(d,b),f=e[0],h=e[1],d=f,i=a.more,j=0,k=h.length;k>j;j++)if(g=h[j],i=this.push(g),i===a.noMore)return i;return i})},b.prototype.scan=function(b,c){var d,e,f=this;return c=G(c),d=K(b),e=function(b){var e,g,h,i;return e=!1,i=D,g=a.more,h=function(){return e?void 0:(e=!0,d.forEach(function(c){return g=b(u(c)),g===a.noMore?(i(),i=D):void 0}))},i=f.subscribe(function(f){return f.hasValue()?e&&f.isInitial()?a.more:(e=!0,d=new o(c(d.getOrElse(void 0),f.value())),b(f.apply(M.always(d.get())))):(f.isEnd()&&(g=h()),g!==a.noMore?b(f):void 0)}),h(),i},new l(e)},b.prototype.fold=function(a,b){return this.scan(a,b).sampledBy(this.filter(!1).mapEnd().toProperty())},b.prototype.zip=function(b,c){return null==c&&(c=Array),a.zipWith([this,b],c)},b.prototype.diff=function(a,b){return b=G(b),this.scan([a],function(a,c){return[c,b(a[0],c)]}).filter(function(a){return 2===a.length}).map(function(a){return a[1]})},b.prototype.flatMap=function(c,d){var e;return c=A(c),e=this,new g(function(f){var g,i,j,k,l,m;return i=[],j=!1,m=function(){},l=function(){var a,b,c;for(m(),b=0,c=i.length;c>b;b++)a=i[b],a();return i=[]},g=function(){return j&&0===i.length?f(r()):void 0},k=function(e){var k,m,n,o,p;return e.isEnd()?(j=!0,g()):e.isError()?f(e):d&&i.length?a.more:(k=c(e.value()),k instanceof b||(k=a.once(k)),p=void 0,m=!1,o=function(){return null!=p&&M.remove(p,i),g()},n=function(b){var c;return b.isEnd()?(o(),m=!0,a.noMore):(b instanceof h&&(b=b.toNext()),c=f(b),c===a.noMore&&l(),c)},p=k.subscribe(n),m?void 0:i.push(p))},m=e.subscribe(k),l})},b.prototype.flatMapFirst=function(a){return this.flatMap(a,!0)},b.prototype.flatMapLatest=function(a){var b;return a=A(a),b=this.toEventStream(),b.flatMap(function(c){return a(c).takeUntil(b)})},b.prototype.not=function(){return this.map(function(a){return!a})},b.prototype.log=function(){var a;return a=1<=arguments.length?Q.call(arguments,0):[],this.subscribe(function(b){return"undefined"!=typeof console&&null!==console?"function"==typeof console.log?console.log.apply(console,Q.call(a).concat([b.describe()])):void 0:void 0}),this},b.prototype.slidingWindow=function(a,b){return null==b&&(b=0),this.scan([],function(b,c){return b.concat([c]).slice(-a)}).filter(function(a){return a.length>=b})},b.prototype.combine=function(b,c){var d;return d=G(c),a.combineAsArray(this,b).map(function(a){return d(a[0],a[1])})},b.prototype.decode=function(b){return this.combine(a.combineTemplate(b),function(a,b){return b[a]})},b}(),k.prototype.reduce=k.prototype.fold,g=function(b){function d(a){var b;d.__super__.constructor.call(this),b=new c(a),this.subscribe=b.subscribe,this.subscribeInternal=this.subscribe,this.hasSubscribers=b.hasSubscribers}return S(d,b),d.prototype.map=function(){var a,b;return b=arguments[0],a=2<=arguments.length?Q.call(arguments,1):[],b instanceof l?b.sampledBy(this,s):d.__super__.map.apply(this,[b].concat(Q.call(a)))},d.prototype.delay=function(b){return this.flatMap(function(c){return a.later(b,c)})},d.prototype.debounce=function(b){return this.flatMapLatest(function(c){return a.later(b,c)})},d.prototype.debounceImmediate=function(b){return this.flatMapFirst(function(c){return a.once(c).concat(a.later(b).filter(!1))})},d.prototype.throttle=function(a){return this.bufferWithTime(a).map(function(a){return a[a.length-1]})},d.prototype.bufferWithTime=function(a){return this.bufferWithTimeOrCount(a,Number.MAX_VALUE)},d.prototype.bufferWithCount=function(a){return this.bufferWithTimeOrCount(void 0,a)},d.prototype.bufferWithTimeOrCount=function(a,b){var c;return c=function(c){return c.values.length===b?c.flush():void 0!==a?c.schedule():void 0},this.buffer(a,c,c)},d.prototype.buffer=function(b,c,d){var e,f,g;return null==c&&(c=function(){}),null==d&&(d=function(){}),e={scheduled:!1,end:null,values:[],flush:function(){var b;if(this.scheduled=!1,this.values.length>0){if(b=this.push(C(this.values)),this.values=[],null!=this.end)return this.push(this.end);if(b!==a.noMore)return d(this)}else if(null!=this.end)return this.push(this.end)},schedule:function(){var a=this;return this.scheduled?void 0:(this.scheduled=!0,b(function(){return a.flush()}))}},g=a.more,w(b)||(f=b,b=function(b){return a.scheduler.setTimeout(b,f)}),this.withHandler(function(a){return e.push=this.push,a.isError()?g=this.push(a):a.isEnd()?(e.end=a,e.scheduled||e.flush()):(e.values.push(a.value()),c(e)),g})},d.prototype.merge=function(b){var c;return c=this,new d(function(d){var e,f,g,h,i,j;return h=D,i=D,j=!1,g=function(){return h(),i(),j=!0},e=0,f=function(b){var c;return b.isEnd()?(e++,2===e?d(r()):a.more):(c=d(b),c===a.noMore&&g(),c)},h=c.subscribe(f),j||(i=b.subscribe(f)),g})},d.prototype.toProperty=function(a){return 0===arguments.length&&(a=j),this.scan(a,x)},d.prototype.toEventStream=function(){return this},d.prototype.concat=function(a){var b;return b=this,new d(function(c){var d;return d=b.subscribe(function(b){return b.isEnd()?d=a.subscribe(c):c(b)}),function(){return d()}})},d.prototype.awaiting=function(a){return this.map(!0).merge(a.map(!1)).toProperty(!1)},d.prototype.startWith=function(b){return a.once(b).concat(this)},d.prototype.withHandler=function(a){var b;return b=new c(this.subscribe,a),new d(b.subscribe)},d.prototype.withSubscribe=function(a){return new d(a)},d}(k),l=function(b){function c(b,d){this.toEventStream=T(this.toEventStream,this),this.toProperty=T(this.toProperty,this),this.changes=T(this.changes,this),this.sample=T(this.sample,this);var e=this;c.__super__.constructor.call(this),this.subscribeInternal=d===!0?b:new m(b,d).subscribe,this.sampledBy=function(a,d){var f,h;return f=null!=d?(d=G(d),function(a,b){return d(a.value(),b.value())}):function(a){return a.value()},h=j,b=function(b){var c,d,g,i;return i=!1,d=D,g=D,c=function(){return d(),g(),i=!0},d=e.subscribeInternal(function(a){return a.hasValue()?h=new o(a):a.isError()?b(a):void 0}),g=a.subscribe(function(a){return a.hasValue()?h.forEach(function(c){return b(a.apply(f(c,a)))}):(a.isEnd()&&d(),b(a))}),c},a instanceof c?new c(b):new g(b)},this.subscribe=function(b){var c,d,f,g,h;return f=a.more,c=function(){function c(){}return c.prototype.set=function(a){return this.event=a},c.prototype.send=function(){var c;return c=this.event,this.event=null,null!=c&&f!==a.noMore&&(f=b(c),f===a.noMore)?g():void 0},c}(),h=new c,d=new c,g=D,g=e.subscribeInternal(function(c){return c.isError()?f!==a.noMore&&(f=b(c)):(c.hasValue()?h.set(c):c.isEnd()&&d.set(c),n.onDone(function(){return h.send(),d.send()})),f}),function(){return f=a.noMore,g()}}}return S(c,b),c.prototype.sample=function(b){return this.sampledBy(a.interval(b,{}))},c.prototype.changes=function(){var a=this;return new g(function(b){return a.subscribe(function(a){return a.isInitial()?void 0:b(a)})})},c.prototype.withHandler=function(a){return new c(this.subscribeInternal,a)},c.prototype.withSubscribe=function(a){return new c(a)},c.prototype.toProperty=function(){return this},c.prototype.toEventStream=function(){var a=this;return new g(function(b){return a.subscribe(function(a){return a.isInitial()&&(a=a.toNext()),b(a)})})},c.prototype.and=function(a){return this.combine(a,function(a,b){return a&&b})},c.prototype.or=function(a){return this.combine(a,function(a,b){return a||b})},c.prototype.delay=function(a){return this.delayChanges(function(b){return b.delay(a)})},c.prototype.debounce=function(a){return this.delayChanges(function(b){return b.debounce(a)})},c.prototype.throttle=function(a){return this.delayChanges(function(b){return b.throttle(a)})},c.prototype.delayChanges=function(a){return p(this,a(this.changes()))},c}(k),p=function(b,c){var d;return d=function(b){var c;return c=j,b.subscribe(function(b){return b.hasValue()&&(c=new o(b.value())),a.noMore}),c},c.toProperty(d(b))},c=function(){function b(b,c){var d,e,g,h,i,j,k,l,m,n,o=this;null==b&&(b=function(){return D}),l=[],j=null,i=!1,g=!1,this.hasSubscribers=function(){return l.length>0},h=null,m=D,k=function(a){return l=M.without(a,l)},n=null,e=function(a){var b,c,d,e;if(null!=n)for(c=n,n=null,d=0,e=c.length;e>d;d++)b=c[d],b();return a.onDone=f.prototype.onDone},d=function(a){return n=(n||[]).concat([a])},this.push=function(b){var c,f,g,m,n,p;if(i)return j=(j||[]).concat([b]),a.more;if(b!==h){b.isError()&&(h=b),g=!1;try{for(i=!0,b.onDone=d,m=l,n=0,p=m.length;p>n;n++)f=m[n],c=f.sink(b),(c===a.noMore||b.isEnd())&&k(f);g=!0}finally{i=!1,g||(j=null)}for(g=!0;null!=j?j.length:void 0;)b=M.head(j),j=M.tail(j),o.push(b);return e(b),o.hasSubscribers()?a.more:a.noMore}},null==c&&(c=function(a){return this.push(a)}),this.handleEvent=function(a){return a.isEnd()&&(g=!0),c.apply(o,[a])},this.subscribe=function(a){var c;return g?(a(r()),D):(c={sink:a},l=l.concat(c),1===l.length&&(m=b(o.handleEvent)),function(){return k(c),o.hasSubscribers()?void 0:m()})}}return b}(),m=function(b){function c(b,d){var e,f,g,h=this;c.__super__.constructor.call(this,b,d),e=j,g=this.push,b=this.subscribe,f=!1,this.push=function(a){return a.isEnd()&&(f=!0),a.hasValue()&&(e=new o(a.value())),n.inTransaction(function(){return g.apply(h,[a])})},this.subscribe=function(c){var d,g,i;return d=!1,i=function(){return h.hasSubscribers()||f},g=e.filter(i).map(function(a){return c(u(a))}),g.getOrElse(a.more)===a.noMore?D:f?(c(r()),D):b.apply(h,[c])}}return S(c,b),c}(c),n=function(){var a,b,c,d;return d=[],c=!1,b=function(a){return c?d.push(a):a()},a=function(a){var b,e,f,g,h;if(c)return a();c=!0;try{a()}finally{c=!1}for(e=d,d=[],h=[],f=0,g=e.length;g>f;f++)b=e[f],h.push(b());return h},{onDone:b,inTransaction:a}}(),b=function(b){function c(){var b,d,f,g,h,i,j,k;f=void 0,i=[],b=!1,d=function(b){return function(c){return c.isEnd()?(k(b),a.noMore):f(c)}},j=function(){var a,b,c,d;for(d=[],b=0,c=i.length;c>b;b++)a=i[b],d.push("function"==typeof a.unsub?a.unsub():void 0);return d},h=function(a){return a.unsub=a.input.subscribe(d(a.input))},k=function(a){var b,c,d,e;for(b=d=0,e=i.length;e>d;b=++d)if(c=i[b],c.input===a)return"function"==typeof c.unsub&&c.unsub(),i.splice(b,1),void 0},g=function(a){var b,c,d,e,g;for(f=a,c=[],g=q(i),d=0,e=g.length;e>d;d++)b=g[d],h(b);return j},c.__super__.constructor.call(this,g),this.plug=function(a){var c;if(!b)return c={input:a},i.push(c),null!=f&&h(c),function(){return k(a)}},this.push=function(a){return"function"==typeof f?f(C(a)):void 0},this.error=function(a){return"function"==typeof f?f(new e(a)):void 0},this.end=function(){return b=!0,j(),"function"==typeof f?f(r()):void 0}}return S(c,b),c}(g),o=function(){function a(a){this.value=a}return a.prototype.getOrElse=function(){return this.value},a.prototype.get=function(){return this.value},a.prototype.filter=function(b){return b(this.value)?new a(this.value):j},a.prototype.map=function(b){return new a(b(this.value))},a.prototype.forEach=function(a){return a(this.value)},a.prototype.isDefined=!0,a.prototype.toArray=function(){return[this.value]},a}(),j={getOrElse:function(a){return a},filter:function(){return j},map:function(){return j},forEach:function(){},isDefined:!1,toArray:function(){return[]}},a.EventStream=g,a.Property=l,a.Observable=k,a.Bus=b,a.Initial=h,a.Next=i,a.End=d,a.Error=e,D=function(){},x=function(a,b){return b},s=function(a){return a},u=function(a){return new h(M.always(a))},C=function(a){return new i(M.always(a))},r=function(){return new d},H=function(a){return a instanceof f?a:C(a)},q=function(a){return a.slice(0)},t=Array.prototype.indexOf?function(a,b){return a.indexOf(b)}:function(a,b){var c,d,e,f;for(c=e=0,f=a.length;f>e;c=++e)if(d=a[c],b===d)return c;return-1},w=function(a){return"function"==typeof a},B=function(a,b,c){return void 0===c&&(c=[]),function(d){return a[b].apply(a,c.concat([d]))}},E=function(a,b){return function(){var c;return c=1<=arguments.length?Q.call(arguments,0):[],a.apply(null,b.concat(c))}},A=function(a){return a instanceof k&&(a=M.always(a)),a},z=function(a,b){return w(a)?b.length?E(a,b):a:v(a)?I(a,b):"object"==typeof a&&b.length?B(a,M.head(b),M.tail(b)):M.always(a)},v=function(a){return"string"==typeof a&&a.length>1&&"."===a.charAt(0)},a.isFieldKey=v,I=function(a,b){var c,d;return d=a.slice(1).split("."),c=M.map(L(b),d),function(b){var d,e;for(d=0,e=c.length;e>d;d++)a=c[d],b=a(b);return b}},L=function(a){return function(b){return function(c){var d;return null==c?void 0:(d=c[b],w(d)?d.apply(c,a):d)}}},J=function(a){return a.slice(1)},G=function(a){var b;return w(a)?a:v(a)?(b=J(a),function(a,c){return a[b](c)}):void 0},K=function(a){return a instanceof o||a===j?a:new o(a)},"undefined"!=typeof define&&null!==define&&null!=define.amd&&"function"==typeof define&&define(function(){return a}),M={head:function(a){return a[0]},always:function(a){return function(){return a}},empty:function(a){return 0===a.length},tail:function(a){return a.slice(1,a.length)},filter:function(a,b){var c,d,e,f;for(c=[],e=0,f=b.length;f>e;e++)d=b[e],a(d)&&c.push(d);return c},map:function(a,b){var c,d,e,f;for(f=[],d=0,e=b.length;e>d;d++)c=b[d],f.push(a(c));return f},each:function(a,b){var c,d,e;e=[];for(c in a)d=a[c],e.push(b(c,d));return e},toArray:function(a){return a instanceof Array?a:[a]},contains:function(a,b){return-1!==t(a,b)},id:function(a){return a},last:function(a){return a[a.length-1]},all:function(a){var b,c,d;for(c=0,d=a.length;d>c;c++)if(b=a[c],!b)return!1;return!0},any:function(a){var b,c,d;for(c=0,d=a.length;d>c;c++)if(b=a[c])return!0;return!1},without:function(a,b){return M.filter(function(b){return b!==a},b)},remove:function(a,b){var c;return c=t(b,a),c>=0?b.splice(c,1):void 0}},a._=M,a.scheduler={setTimeout:function(a,b){return setTimeout(a,b)},setInterval:function(a,b){return setInterval(a,b)},clearInterval:function(a){return clearInterval(a)},now:function(){return(new Date).getTime()}}}.call(this); | ||
!function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q=[].slice,R={}.hasOwnProperty,S=function(a,b){function c(){this.constructor=a}for(var d in b)R.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},T=function(a,b){return function(){return a.apply(b,arguments)}};"undefined"!=typeof module&&null!==module?(module.exports=a={},a.Bacon=a):("function"==typeof require&&null!=require.amd&&define("bacon",[],function(){return a}),this.Bacon=a={}),a.fromBinder=function(b,c){return null==c&&(c=M.id),new g(function(d){var e;return e=b(function(){var b,g,h,i,j,k,l;for(b=1<=arguments.length?Q.call(arguments,0):[],i=c.apply(null,b),i instanceof Array&&M.last(i)instanceof f||(i=[i]),l=[],j=0,k=i.length;k>j;j++)g=i[j],h=d(g=H(g)),h===a.noMore||g.isEnd()?null!=e?l.push(e()):l.push(a.scheduler.setTimeout(function(){return e()},0)):l.push(void 0);return l})})},a.$={asEventStream:function(b,c,d){var e,f=this;return w(c)&&(e=[c,null],d=e[0],c=e[1]),a.fromBinder(function(a){return f.on(b,c,a),function(){return f.off(b,c,a)}},d)}},null!=(N="undefined"!=typeof jQuery&&null!==jQuery?jQuery:"undefined"!=typeof Zepto&&null!==Zepto?Zepto:null)&&(N.fn.asEventStream=a.$.asEventStream),a.fromEventTarget=function(b,c,d){var e,f,g,h,i,j;return e=null!=(g=b.addEventListener)?g:null!=(h=b.addListener)?h:b.bind,f=null!=(i=b.removeEventListener)?i:null!=(j=b.removeListener)?j:b.unbind,a.fromBinder(function(a){return e.call(b,c,a),function(){return f.call(b,c,a)}},d)},a.fromPromise=function(b,c){return a.fromBinder(function(a){return b.then(a,function(b){return a(new e(b))}),function(){return c?"function"==typeof b.abort?b.abort():void 0:void 0}},function(a){return[a,r()]})},a.noMore=["<no-more>"],a.more=["<more>"],a.later=function(b,c){return a.sequentially(b,[c])},a.sequentially=function(b,c){var d;return d=0,a.fromPoll(b,function(){var a;return a=c[d++],d<c.length?a:d===c.length?[a,r()]:r()})},a.repeatedly=function(b,c){var d;return d=0,a.fromPoll(b,function(){return c[d++%c.length]})},y=function(b){return function(){var c,d,e;return d=arguments[0],c=2<=arguments.length?Q.call(arguments,1):[],e=E(b,[function(a,b){return d.apply(null,Q.call(a).concat([b]))}]),a.combineAsArray(c).flatMap(e)}},a.fromCallback=y(function(){var b,c;return c=arguments[0],b=2<=arguments.length?Q.call(arguments,1):[],a.fromBinder(function(a){return z(c,b)(a),D},function(a){return[a,r()]})}),a.fromNodeCallback=y(function(){var b,c;return c=arguments[0],b=2<=arguments.length?Q.call(arguments,1):[],a.fromBinder(function(a){return z(c,b)(a),D},function(a,b){return a?[new e(a),r()]:[b,r()]})}),a.fromPoll=function(b,c){return a.fromBinder(function(c){var d;return d=a.scheduler.setInterval(c,b),function(){return a.scheduler.clearInterval(d)}},c)},a.interval=function(b,c){return null==c&&(c={}),a.fromPoll(b,function(){return C(c)})},a.constant=function(a){return new l(F([a],u),!0)},a.never=function(){return a.fromArray([])},a.once=function(b){return a.fromArray([b])},a.fromArray=function(a){return new g(F(a,H))},F=function(a,b){return function(c){var d,e,f;for(e=0,f=a.length;f>e;e++)d=a[e],c(b(d));return c(r()),D}},a.mergeAll=function(){var a,b,c,d,e,f,g;for(d=arguments[0],a=2<=arguments.length?Q.call(arguments,1):[],d instanceof Array||(d=[d].concat(a)),c=M.head(d),g=M.tail(d),e=0,f=g.length;f>e;e++)b=g[e],c=c.merge(b);return c},a.zipAsArray=function(){var b,c;return c=arguments[0],b=2<=arguments.length?Q.call(arguments,1):[],c instanceof Array||(c=[c].concat(b)),a.zipWith(c,Array)},a.zipWith=function(){var b,c,d,e;return e=arguments[0],b=arguments[1],d=3<=arguments.length?Q.call(arguments,2):[],w(e)&&(c=e,e=[b].concat(d),b=c),new g(function(c){var d,f,g,h,i,j,k,l,m,n;for(d=function(){var a,b,c;for(c=[],a=0,b=e.length;b>a;a++)h=e[a],c.push([]);return c}(),k=!1,j=function(){var a,b,c;for(c=[],a=0,b=e.length;b>a;a++)h=e[a],c.push(D);return c}(),i=function(){var a,c;for(a=0,c=j.length;c>a;a++)b=j[a],b();return k=!0},l=function(b){var d;return d=c(b),(d===a.noMore||b.isEnd())&&i(),d},f=function(c){return function(e){var f,g,h;return e.isError()?l(e):e.isInitial()?a.more:(d[c].push(e),!e.isEnd()&&M.all(function(){var a,b,c;for(c=[],a=0,b=d.length;b>a;a++)f=d[a],c.push(f.length);return c}())&&(h=function(){var a,b,c;for(c=[],a=0,b=d.length;b>a;a++)f=d[a],c.push(f.shift().value());return c}(),g=l(e.apply(M.always(b.apply(null,h))))),M.any(function(){var a,b,c;for(c=[],a=0,b=d.length;b>a;a++)f=d[a],c.push(f.length&&f[0].isEnd());return c}())&&(g=l(r())),g||a.more)}},g=m=0,n=e.length;n>m;g=++m)h=e[g],j[g]=function(a){return k?void 0:h.subscribe(f(a))}(g);return i})},a.combineAsArray=function(){var b,c,d,e;return d=arguments[0],b=2<=arguments.length?Q.call(arguments,1):[],d instanceof Array||(d=[d].concat(b)),d.length?(e=function(){var a,b,e;for(e=[],a=0,b=d.length;b>a;a++)c=d[a],e.push(j);return e}(),new l(function(b){var f,g,h,i,j,l,m,n,p,q,s,t;for(q=!1,p=function(){var a,b,e;for(e=[],a=0,b=d.length;b>a;a++)c=d[a],e.push(D);return e}(),n=function(){var a,b,c;for(b=0,c=p.length;c>b;b++)a=p[b],a();return q=!0},h=function(){var a,b,e;for(e=[],a=0,b=d.length;b>a;a++)c=d[a],e.push(!1);return e}(),f=function(){var c;return M.all(h)?(c=b(r()),c===a.noMore&&n(),c):void 0},j=!1,g=function(c,d){return function(g){var h,i;return g.isEnd()?(c(),f(),a.noMore):g.isError()?(h=b(g),h===a.noMore&&n(),h):(d(g.value),M.all(M.map(function(a){return a.isDefined},e))?j&&g.isInitial()?a.more:(j=!0,i=function(){var a,b,c,d;for(d=[],b=0,c=e.length;c>b;b++)a=e[b],d.push(a.get()());return d},h=b(g.apply(i)),h===a.noMore&&n(),h):a.more)}},l=function(a){return g(function(){return h[a]=!0},function(b){return e[a]=new o(b)})},i=s=0,t=d.length;t>s;i=++s)m=d[i],m instanceof k||(m=a.constant(m)),q||(p[i]=m.subscribeInternal(l(i)));return n})):a.constant([])},a.onValues=function(){var b,c,d;return c=2<=arguments.length?Q.call(arguments,0,d=arguments.length-1):(d=0,[]),b=arguments[d++],a.combineAsArray(c).onValues(b)},a.combineWith=function(){var b,c;return b=arguments[0],c=2<=arguments.length?Q.call(arguments,1):[],a.combineAsArray(c).map(function(a){return b.apply(null,a)})},a.combineTemplate=function(b){var c,d,e,f,g,h,i,j,l,m;return i=[],m=[],h=function(a){return a[a.length-1]},l=function(a,b,c){return h(a)[b]=c},c=function(a,b){return function(c,d){return l(c,a,d[b])}},g=function(a,b){return function(c){return l(c,a,b)}},j=function(a){return a instanceof Array?[]:{}},e=function(a,b){var d,e;return b instanceof k?(m.push(b),i.push(c(a,m.length-1))):b===Object(b)&&"function"!=typeof b?(e=function(a){return function(c){var d;return d=j(b),l(c,a,d),c.push(d)}},d=function(a){return a.pop()},i.push(e(a)),f(b),i.push(d)):i.push(g(a,b))},f=function(a){return M.each(a,e)},f(b),d=function(a){var c,d,e,f,g;for(e=j(b),c=[e],f=0,g=i.length;g>f;f++)d=i[f],d(c,a);return e},a.combineAsArray(m).map(d)},f=function(){function a(){}return a.prototype.isEvent=function(){return!0},a.prototype.isEnd=function(){return!1},a.prototype.isInitial=function(){return!1},a.prototype.isNext=function(){return!1},a.prototype.isError=function(){return!1},a.prototype.hasValue=function(){return!1},a.prototype.filter=function(){return!0},a.prototype.onDone=function(a){return a()},a}(),i=function(a){function b(a){var b=this;this.value=w(a)?function(){var c;return c=a(),b.value=M.always(c),c}:M.always(a)}return S(b,a),b.prototype.isNext=function(){return!0},b.prototype.hasValue=function(){return!0},b.prototype.fmap=function(a){var b=this;return this.apply(function(){return a(b.value())})},b.prototype.apply=function(a){return new b(a)},b.prototype.filter=function(a){return a(this.value())},b.prototype.describe=function(){return this.value()},b}(f),h=function(a){function b(){return O=b.__super__.constructor.apply(this,arguments)}return S(b,a),b.prototype.isInitial=function(){return!0},b.prototype.isNext=function(){return!1},b.prototype.apply=function(a){return new b(a)},b.prototype.toNext=function(){return new i(this.value)},b}(i),d=function(a){function b(){return P=b.__super__.constructor.apply(this,arguments)}return S(b,a),b.prototype.isEnd=function(){return!0},b.prototype.fmap=function(){return this},b.prototype.apply=function(){return this},b.prototype.describe=function(){return"<end>"},b}(f),e=function(a){function b(a){this.error=a}return S(b,a),b.prototype.isError=function(){return!0},b.prototype.fmap=function(){return this},b.prototype.apply=function(){return this},b.prototype.describe=function(){return"<error> "+this.error},b}(f),k=function(){function b(){this.combine=T(this.combine,this),this.flatMapLatest=T(this.flatMapLatest,this),this.fold=T(this.fold,this),this.scan=T(this.scan,this),this.takeUntil=T(this.takeUntil,this),this.assign=this.onValue}return b.prototype.onValue=function(){var a,b;return b=arguments[0],a=2<=arguments.length?Q.call(arguments,1):[],b=z(b,a),this.subscribe(function(a){return a.hasValue()?b(a.value()):void 0})},b.prototype.onValues=function(a){return this.onValue(function(b){return a.apply(null,b)})},b.prototype.onError=function(){var a,b;return b=arguments[0],a=2<=arguments.length?Q.call(arguments,1):[],b=z(b,a),this.subscribe(function(a){return a.isError()?b(a.error):void 0})},b.prototype.onEnd=function(){var a,b;return b=arguments[0],a=2<=arguments.length?Q.call(arguments,1):[],b=z(b,a),this.subscribe(function(a){return a.isEnd()?b():void 0})},b.prototype.errors=function(){return this.filter(function(){return!1})},b.prototype.filter=function(){var b,c;return c=arguments[0],b=2<=arguments.length?Q.call(arguments,1):[],c instanceof l?c.sampledBy(this,function(a,b){return[a,b]}).filter(function(a){var b,c;return b=a[0],c=a[1],b}).map(function(a){var b,c;return b=a[0],c=a[1]}):(c=z(c,b),this.withHandler(function(b){return b.filter(c)?this.push(b):a.more}))},b.prototype.takeWhile=function(){var b,c;return c=arguments[0],b=2<=arguments.length?Q.call(arguments,1):[],c=z(c,b),this.withHandler(function(b){return b.filter(c)?this.push(b):(this.push(r()),a.noMore)})},b.prototype.endOnError=function(){return this.withHandler(function(a){return a.isError()?(this.push(a),this.push(r())):this.push(a)})},b.prototype.take=function(b){return 0>=b?a.never():this.withHandler(function(c){return c.hasValue()?(b--,b>0?this.push(c):(0===b&&this.push(c),this.push(r()),a.noMore)):this.push(c)})},b.prototype.map=function(){var a,b;return b=arguments[0],a=2<=arguments.length?Q.call(arguments,1):[],b=z(b,a),this.withHandler(function(a){return this.push(a.fmap(b))})},b.prototype.mapError=function(){var a,b;return b=arguments[0],a=2<=arguments.length?Q.call(arguments,1):[],b=z(b,a),this.withHandler(function(a){return a.isError()?this.push(C(b(a.error))):this.push(a)})},b.prototype.mapEnd=function(){var b,c;return c=arguments[0],b=2<=arguments.length?Q.call(arguments,1):[],c=z(c,b),this.withHandler(function(b){return b.isEnd()?(this.push(C(c(b))),this.push(r()),a.noMore):this.push(b)})},b.prototype.doAction=function(){var a,b;return b=arguments[0],a=2<=arguments.length?Q.call(arguments,1):[],b=z(b,a),this.withHandler(function(a){return a.hasValue()&&b(a.value()),this.push(a)})},b.prototype.takeUntil=function(b){var c;return c=this,this.withSubscribe(function(d){var e,f,g,h,i,j;return j=!1,h=D,i=D,g=function(){return h(),i(),j=!0},e=function(b){return b.isEnd()?(i(),d(b),a.noMore):(b.onDone(function(){var c;return j||(c=d(b),c!==a.noMore)?void 0:g()}),a.more)},f=function(b){return b.isError()?a.more:b.isEnd()?a.noMore:(h(),d(r()),a.noMore)},h=c.subscribe(e),j||(i=b.subscribe(f)),g})},b.prototype.skip=function(b){return this.withHandler(function(c){return c.hasValue()?b>0?(b--,a.more):this.push(c):this.push(c)})},b.prototype.skipDuplicates=function(a){return null==a&&(a=function(a,b){return a===b}),this.withStateMachine(j,function(b,c){return c.hasValue()?b!==j&&a(b.get(),c.value())?[b,[]]:[new o(c.value()),[c]]:[b,[c]]})},b.prototype.withStateMachine=function(b,c){var d;return d=b,this.withHandler(function(b){var e,f,g,h,i,j,k;for(e=c(d,b),f=e[0],h=e[1],d=f,i=a.more,j=0,k=h.length;k>j;j++)if(g=h[j],i=this.push(g),i===a.noMore)return i;return i})},b.prototype.scan=function(b,c){var d,e,f=this;return c=G(c),d=K(b),e=function(b){var e,g,h,i;return e=!1,i=D,g=a.more,h=function(){return e?void 0:(e=!0,d.forEach(function(c){return g=b(u(c)),g===a.noMore?(i(),i=D):void 0}))},i=f.subscribe(function(f){return f.hasValue()?e&&f.isInitial()?a.more:(e=!0,d=new o(c(d.getOrElse(void 0),f.value())),b(f.apply(M.always(d.get())))):(f.isEnd()&&(g=h()),g!==a.noMore?b(f):void 0)}),h(),i},new l(e)},b.prototype.fold=function(a,b){return this.scan(a,b).sampledBy(this.filter(!1).mapEnd().toProperty())},b.prototype.zip=function(b,c){return null==c&&(c=Array),a.zipWith([this,b],c)},b.prototype.diff=function(a,b){return b=G(b),this.scan([a],function(a,c){return[c,b(a[0],c)]}).filter(function(a){return 2===a.length}).map(function(a){return a[1]})},b.prototype.flatMap=function(c,d){var e;return c=A(c),e=this,new g(function(f){var g,i,j,k,l,m;return i=[],j=!1,m=function(){},l=function(){var a,b,c;for(m(),b=0,c=i.length;c>b;b++)a=i[b],a();return i=[]},g=function(){return j&&0===i.length?f(r()):void 0},k=function(e){var k,m,n,o,p;return e.isEnd()?(j=!0,g()):e.isError()?f(e):d&&i.length?a.more:(k=c(e.value()),k instanceof b||(k=a.once(k)),p=void 0,m=!1,o=function(){return null!=p&&M.remove(p,i),g()},n=function(b){var c;return b.isEnd()?(o(),m=!0,a.noMore):(b instanceof h&&(b=b.toNext()),c=f(b),c===a.noMore&&l(),c)},p=k.subscribe(n),m?void 0:i.push(p))},m=e.subscribe(k),l})},b.prototype.flatMapFirst=function(a){return this.flatMap(a,!0)},b.prototype.flatMapLatest=function(a){var b;return a=A(a),b=this.toEventStream(),b.flatMap(function(c){return a(c).takeUntil(b)})},b.prototype.not=function(){return this.map(function(a){return!a})},b.prototype.log=function(){var a;return a=1<=arguments.length?Q.call(arguments,0):[],this.subscribe(function(b){return"undefined"!=typeof console&&null!==console?"function"==typeof console.log?console.log.apply(console,Q.call(a).concat([b.describe()])):void 0:void 0}),this},b.prototype.slidingWindow=function(a,b){return null==b&&(b=0),this.scan([],function(b,c){return b.concat([c]).slice(-a)}).filter(function(a){return a.length>=b})},b.prototype.combine=function(b,c){var d;return d=G(c),a.combineAsArray(this,b).map(function(a){return d(a[0],a[1])})},b.prototype.decode=function(b){return this.combine(a.combineTemplate(b),function(a,b){return b[a]})},b}(),k.prototype.reduce=k.prototype.fold,g=function(b){function d(a){var b;d.__super__.constructor.call(this),b=new c(a),this.subscribe=b.subscribe,this.subscribeInternal=this.subscribe,this.hasSubscribers=b.hasSubscribers}return S(d,b),d.prototype.map=function(){var a,b;return b=arguments[0],a=2<=arguments.length?Q.call(arguments,1):[],b instanceof l?b.sampledBy(this,s):d.__super__.map.apply(this,[b].concat(Q.call(a)))},d.prototype.delay=function(b){return this.flatMap(function(c){return a.later(b,c)})},d.prototype.debounce=function(b){return this.flatMapLatest(function(c){return a.later(b,c)})},d.prototype.debounceImmediate=function(b){return this.flatMapFirst(function(c){return a.once(c).concat(a.later(b).filter(!1))})},d.prototype.throttle=function(a){return this.bufferWithTime(a).map(function(a){return a[a.length-1]})},d.prototype.bufferWithTime=function(a){return this.bufferWithTimeOrCount(a,Number.MAX_VALUE)},d.prototype.bufferWithCount=function(a){return this.bufferWithTimeOrCount(void 0,a)},d.prototype.bufferWithTimeOrCount=function(a,b){var c;return c=function(c){return c.values.length===b?c.flush():void 0!==a?c.schedule():void 0},this.buffer(a,c,c)},d.prototype.buffer=function(b,c,d){var e,f,g;return null==c&&(c=function(){}),null==d&&(d=function(){}),e={scheduled:!1,end:null,values:[],flush:function(){var b;if(this.scheduled=!1,this.values.length>0){if(b=this.push(C(this.values)),this.values=[],null!=this.end)return this.push(this.end);if(b!==a.noMore)return d(this)}else if(null!=this.end)return this.push(this.end)},schedule:function(){var a=this;return this.scheduled?void 0:(this.scheduled=!0,b(function(){return a.flush()}))}},g=a.more,w(b)||(f=b,b=function(b){return a.scheduler.setTimeout(b,f)}),this.withHandler(function(a){return e.push=this.push,a.isError()?g=this.push(a):a.isEnd()?(e.end=a,e.scheduled||e.flush()):(e.values.push(a.value()),c(e)),g})},d.prototype.merge=function(b){var c;return c=this,new d(function(d){var e,f,g,h,i,j;return h=D,i=D,j=!1,g=function(){return h(),i(),j=!0},e=0,f=function(b){var c;return b.isEnd()?(e++,2===e?d(r()):a.more):(c=d(b),c===a.noMore&&g(),c)},h=c.subscribe(f),j||(i=b.subscribe(f)),g})},d.prototype.toProperty=function(a){return 0===arguments.length&&(a=j),this.scan(a,x)},d.prototype.toEventStream=function(){return this},d.prototype.concat=function(a){var b;return b=this,new d(function(c){var d;return d=b.subscribe(function(b){return b.isEnd()?d=a.subscribe(c):c(b)}),function(){return d()}})},d.prototype.awaiting=function(a){return this.map(!0).merge(a.map(!1)).toProperty(!1)},d.prototype.startWith=function(b){return a.once(b).concat(this)},d.prototype.withHandler=function(a){var b;return b=new c(this.subscribe,a),new d(b.subscribe)},d.prototype.withSubscribe=function(a){return new d(a)},d}(k),l=function(b){function c(b,d){this.toEventStream=T(this.toEventStream,this),this.toProperty=T(this.toProperty,this),this.changes=T(this.changes,this),this.sample=T(this.sample,this);var e=this;c.__super__.constructor.call(this),this.subscribeInternal=d===!0?b:new m(b,d).subscribe,this.sampledBy=function(a,d){var f,h;return f=null!=d?(d=G(d),function(a,b){return d(a.value(),b.value())}):function(a){return a.value()},h=j,b=function(b){var c,d,g,i;return i=!1,d=D,g=D,c=function(){return d(),g(),i=!0},d=e.subscribeInternal(function(a){return a.hasValue()?h=new o(a):a.isError()?b(a):void 0}),g=a.subscribe(function(a){return a.hasValue()?h.forEach(function(c){return b(a.apply(f(c,a)))}):(a.isEnd()&&d(),b(a))}),c},a instanceof c?new c(b):new g(b)},this.subscribe=function(b){var c,d,f,g,h;return f=a.more,c=function(){function c(){}return c.prototype.set=function(a){return this.event=a},c.prototype.send=function(){var c;return c=this.event,this.event=null,null!=c&&f!==a.noMore&&(f=b(c),f===a.noMore)?g():void 0},c}(),h=new c,d=new c,g=D,g=e.subscribeInternal(function(c){return c.isError()?f!==a.noMore&&(f=b(c)):(c.hasValue()?h.set(c):c.isEnd()&&d.set(c),n.onDone(function(){return h.send(),d.send()})),f}),function(){return f=a.noMore,g()}}}return S(c,b),c.prototype.sample=function(b){return this.sampledBy(a.interval(b,{}))},c.prototype.changes=function(){var a=this;return new g(function(b){return a.subscribe(function(a){return a.isInitial()?void 0:b(a)})})},c.prototype.withHandler=function(a){return new c(this.subscribeInternal,a)},c.prototype.withSubscribe=function(a){return new c(a)},c.prototype.toProperty=function(){return this},c.prototype.toEventStream=function(){var a=this;return new g(function(b){return a.subscribe(function(a){return a.isInitial()&&(a=a.toNext()),b(a)})})},c.prototype.and=function(a){return this.combine(a,function(a,b){return a&&b})},c.prototype.or=function(a){return this.combine(a,function(a,b){return a||b})},c.prototype.delay=function(a){return this.delayChanges(function(b){return b.delay(a)})},c.prototype.debounce=function(a){return this.delayChanges(function(b){return b.debounce(a)})},c.prototype.throttle=function(a){return this.delayChanges(function(b){return b.throttle(a)})},c.prototype.delayChanges=function(a){return p(this,a(this.changes()))},c}(k),p=function(b,c){var d;return d=function(b){var c;return c=j,b.subscribe(function(b){return b.hasValue()&&(c=new o(b.value())),a.noMore}),c},c.toProperty(d(b))},c=function(){function b(b,c){var d,e,g,h,i,j,k,l,m,n,o=this;null==b&&(b=function(){return D}),l=[],j=null,i=!1,g=!1,this.hasSubscribers=function(){return l.length>0},h=null,m=D,k=function(a){return l=M.without(a,l)},n=null,e=function(a){var b,c,d,e;if(null!=n)for(c=n,n=null,d=0,e=c.length;e>d;d++)b=c[d],b();return a.onDone=f.prototype.onDone},d=function(a){return n=(n||[]).concat([a])},this.push=function(b){var c,f,g,m,n,p;if(i)return j=(j||[]).concat([b]),a.more;if(b!==h){b.isError()&&(h=b),g=!1;try{for(i=!0,b.onDone=d,m=l,n=0,p=m.length;p>n;n++)f=m[n],c=f.sink(b),(c===a.noMore||b.isEnd())&&k(f);g=!0}finally{i=!1,g||(j=null)}for(g=!0;null!=j?j.length:void 0;)b=M.head(j),j=M.tail(j),o.push(b);return e(b),o.hasSubscribers()?a.more:a.noMore}},null==c&&(c=function(a){return this.push(a)}),this.handleEvent=function(a){return a.isEnd()&&(g=!0),c.apply(o,[a])},this.subscribe=function(a){var c;return g?(a(r()),D):(c={sink:a},l=l.concat(c),1===l.length&&(m=b(o.handleEvent)),function(){return k(c),o.hasSubscribers()?void 0:m()})}}return b}(),m=function(b){function c(b,d){var e,f,g,h=this;c.__super__.constructor.call(this,b,d),e=j,g=this.push,b=this.subscribe,f=!1,this.push=function(a){return a.isEnd()&&(f=!0),a.hasValue()&&(e=new o(a.value())),n.inTransaction(function(){return g.apply(h,[a])})},this.subscribe=function(c){var d,g,i;return d=!1,i=function(){return h.hasSubscribers()||f},g=e.filter(i).map(function(a){return c(u(a))}),g.getOrElse(a.more)===a.noMore?D:f?(c(r()),D):b.apply(h,[c])}}return S(c,b),c}(c),n=function(){var a,b,c,d;return d=[],c=!1,b=function(a){return c?d.push(a):a()},a=function(a){var b,e,f,g,h;if(c)return a();c=!0;try{a()}finally{c=!1}for(e=d,d=[],h=[],f=0,g=e.length;g>f;f++)b=e[f],h.push(b());return h},{onDone:b,inTransaction:a}}(),b=function(b){function c(){var b,d,f,g,h,i,j,k;f=void 0,i=[],b=!1,d=function(b){return function(c){return c.isEnd()?(k(b),a.noMore):f(c)}},j=function(){var a,b,c,d;for(d=[],b=0,c=i.length;c>b;b++)a=i[b],d.push("function"==typeof a.unsub?a.unsub():void 0);return d},h=function(a){return a.unsub=a.input.subscribe(d(a.input))},k=function(a){var b,c,d,e;for(b=d=0,e=i.length;e>d;b=++d)if(c=i[b],c.input===a)return"function"==typeof c.unsub&&c.unsub(),i.splice(b,1),void 0},g=function(a){var b,c,d,e,g;for(f=a,c=[],g=q(i),d=0,e=g.length;e>d;d++)b=g[d],h(b);return j},c.__super__.constructor.call(this,g),this.plug=function(a){var c;if(!b)return c={input:a},i.push(c),null!=f&&h(c),function(){return k(a)}},this.push=function(a){return"function"==typeof f?f(C(a)):void 0},this.error=function(a){return"function"==typeof f?f(new e(a)):void 0},this.end=function(){return b=!0,j(),"function"==typeof f?f(r()):void 0}}return S(c,b),c}(g),o=function(){function a(a){this.value=a}return a.prototype.getOrElse=function(){return this.value},a.prototype.get=function(){return this.value},a.prototype.filter=function(b){return b(this.value)?new a(this.value):j},a.prototype.map=function(b){return new a(b(this.value))},a.prototype.forEach=function(a){return a(this.value)},a.prototype.isDefined=!0,a.prototype.toArray=function(){return[this.value]},a}(),j={getOrElse:function(a){return a},filter:function(){return j},map:function(){return j},forEach:function(){},isDefined:!1,toArray:function(){return[]}},a.EventStream=g,a.Property=l,a.Observable=k,a.Bus=b,a.Initial=h,a.Next=i,a.End=d,a.Error=e,D=function(){},x=function(a,b){return b},s=function(a){return a},u=function(a){return new h(M.always(a))},C=function(a){return new i(M.always(a))},r=function(){return new d},H=function(a){return a instanceof f?a:C(a)},q=function(a){return a.slice(0)},t=Array.prototype.indexOf?function(a,b){return a.indexOf(b)}:function(a,b){var c,d,e,f;for(c=e=0,f=a.length;f>e;c=++e)if(d=a[c],b===d)return c;return-1},w=function(a){return"function"==typeof a},B=function(a,b,c){return void 0===c&&(c=[]),function(d){return a[b].apply(a,c.concat([d]))}},E=function(a,b){return function(){var c;return c=1<=arguments.length?Q.call(arguments,0):[],a.apply(null,b.concat(c))}},A=function(a){return a instanceof k&&(a=M.always(a)),a},z=function(a,b){return w(a)?b.length?E(a,b):a:v(a)?I(a,b):"object"==typeof a&&b.length?B(a,M.head(b),M.tail(b)):M.always(a)},v=function(a){return"string"==typeof a&&a.length>1&&"."===a.charAt(0)},a.isFieldKey=v,I=function(a,b){var c,d;return d=a.slice(1).split("."),c=M.map(L(b),d),function(b){var d,e;for(d=0,e=c.length;e>d;d++)a=c[d],b=a(b);return b}},L=function(a){return function(b){return function(c){var d;return null==c?void 0:(d=c[b],w(d)?d.apply(c,a):d)}}},J=function(a){return a.slice(1)},G=function(a){var b;return w(a)?a:v(a)?(b=J(a),function(a,c){return a[b](c)}):void 0},K=function(a){return a instanceof o||a===j?a:new o(a)},"undefined"!=typeof define&&null!==define&&null!=define.amd&&"function"==typeof define&&define(function(){return a}),M={head:function(a){return a[0]},always:function(a){return function(){return a}},empty:function(a){return 0===a.length},tail:function(a){return a.slice(1,a.length)},filter:function(a,b){var c,d,e,f;for(c=[],e=0,f=b.length;f>e;e++)d=b[e],a(d)&&c.push(d);return c},map:function(a,b){var c,d,e,f;for(f=[],d=0,e=b.length;e>d;d++)c=b[d],f.push(a(c));return f},each:function(a,b){var c,d,e;e=[];for(c in a)d=a[c],e.push(b(c,d));return e},toArray:function(a){return a instanceof Array?a:[a]},contains:function(a,b){return-1!==t(a,b)},id:function(a){return a},last:function(a){return a[a.length-1]},all:function(a){var b,c,d;for(c=0,d=a.length;d>c;c++)if(b=a[c],!b)return!1;return!0},any:function(a){var b,c,d;for(c=0,d=a.length;d>c;c++)if(b=a[c])return!0;return!1},without:function(a,b){return M.filter(function(b){return b!==a},b)},remove:function(a,b){var c;return c=t(b,a),c>=0?b.splice(c,1):void 0}},a._=M,a.scheduler={setTimeout:function(a,b){return setTimeout(a,b)},setInterval:function(a,b){return setInterval(a,b)},clearInterval:function(a){return clearInterval(a)},now:function(){return(new Date).getTime()}}}.call(this); |
{ | ||
"name": "baconjs", | ||
"version": "0.4.6", | ||
"version": "0.4.7", | ||
"author": "Juha Paananen", | ||
@@ -5,0 +5,0 @@ "licenses": [ |
@@ -0,1 +1,5 @@ | ||
## 0.4.7 | ||
- Fix #191: End properly even if an exception is thrown (sequentially, take) | ||
## 0.4.6 | ||
@@ -2,0 +6,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
605610
12802