Socket
Socket
Sign inDemoInstall

baconjs

Package Overview
Dependencies
Maintainers
1
Versions
224
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

baconjs - npm Package Compare versions

Comparing version 0.4.1 to 0.4.2

2

component.json
{
"name": "baconjs",
"version": "0.4.1",
"version": "0.4.2",
"main": "./dist/Bacon.js"
}

@@ -1234,18 +1234,19 @@ (function() {

EventStream.prototype.bufferWithTime = function(delay) {
var schedule,
_this = this;
schedule = function(buffer) {
return buffer.schedule();
};
return this.buffer(delay, schedule, schedule);
return this.bufferWithTimeOrCount(delay, Number.MAX_VALUE);
};
EventStream.prototype.bufferWithCount = function(count) {
var flushOnCount;
flushOnCount = function(buffer) {
return this.bufferWithTimeOrCount(void 0, count);
};
EventStream.prototype.bufferWithTimeOrCount = function(delay, count) {
var flushOrSchedule;
flushOrSchedule = function(buffer) {
if (buffer.values.length === count) {
return buffer.flush();
} else if (delay !== void 0) {
return buffer.schedule();
}
};
return this.buffer(0, flushOnCount);
return this.buffer(delay, flushOrSchedule, flushOrSchedule);
};

@@ -1252,0 +1253,0 @@

@@ -1,1 +0,1 @@

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

@@ -5,0 +5,0 @@ "licenses": [

@@ -404,2 +404,3 @@ Bacon.js

source.debounceImmediate(2): a-d-----a-d-----
```

@@ -638,2 +639,6 @@ `observable.doAction(f)` returns a stream/property where the function f

`stream.bufferWithTimeOrCount(delay, count)` buffers stream events and
flushes when either the buffer contains the given number elements or the
given amount of milliseconds has passed since last buffered event.
`stream.toProperty()` creates a Property based on the

@@ -759,3 +764,3 @@ EventStream. Without arguments, you'll get a Property without an initial value.

`Bacon.combineAsArray(s1, s2, ...) just like above, but with streams
`Bacon.combineAsArray(s1, s2, ...)` just like above, but with streams
provided as a list of arguments as opposed to a single array.

@@ -762,0 +767,0 @@

@@ -0,1 +1,5 @@

## 0.4.2
- add bufferWithTimeOrCount (#181)
## 0.4.1

@@ -2,0 +6,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc