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.0.8 to 0.0.9

2

component.json
{
"name": "baconjs",
"version": "0.0.8",
"version": "0.0.9",
"main": "./lib/Bacon.js"
}

@@ -0,6 +1,7 @@

// Generated by CoffeeScript 1.3.3
(function() {
var Bacon, Bus, Dispatcher, End, Error, Event, EventStream, Initial, Next, None, Observable, Property, PropertyDispatcher, Some, addPropertyInitValueToStream, assert, assertArray, assertEvent, assertFunction, assertString, cloneArray, cloneObject, end, former, initial, isEvent, isFieldKey, isFunction, latter, makeFunction, methodCall, next, nop, partiallyApplied, remove, sendWrapped, toCombinator, toEvent, toFieldExtractor, toFieldKey, toOption, toSimpleExtractor, _, _ref,
__slice = Array.prototype.slice,
__hasProp = Object.prototype.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; },
__slice = [].slice,
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };

@@ -11,3 +12,5 @@

var element;
if (eventTransformer == null) eventTransformer = _.id;
if (eventTransformer == null) {
eventTransformer = _.id;
}
if (isFunction(selector)) {

@@ -24,3 +27,5 @@ eventTransformer = selector;

reply = sink(next(eventTransformer.apply(null, args)));
if (reply === Bacon.noMore) return unbind();
if (reply === Bacon.noMore) {
return unbind();
}
};

@@ -109,3 +114,5 @@ unbind = function() {

reply = sink(value);
if (reply === Bacon.noMore || value.isEnd()) return unbind();
if (reply === Bacon.noMore || value.isEnd()) {
return unbind();
}
};

@@ -126,3 +133,5 @@ unbind = function() {

reply = sink(next(event));
if (reply === Bacon.noMore) return unbind();
if (reply === Bacon.noMore) {
return unbind();
}
};

@@ -146,3 +155,5 @@ if (target.addEventListener) {

var poll;
if (value == null) value = {};
if (value == null) {
value = {};
}
poll = function() {

@@ -183,8 +194,8 @@ return next(value);

Bacon.combineAll = function(streams, f) {
var next, stream, _i, _len, _ref2;
var next, stream, _i, _len, _ref1;
assertArray(streams);
stream = _.head(streams);
_ref2 = _.tail(streams);
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
next = _ref2[_i];
_ref1 = _.tail(streams);
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
next = _ref1[_i];
stream = f(stream, next);

@@ -202,5 +213,7 @@ }

Bacon.combineAsArray = function() {
var more, next, stream, streams, _i, _len, _ref2;
var more, next, stream, streams, _i, _len, _ref1;
streams = arguments[0], more = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
if (!(streams instanceof Array)) streams = [streams].concat(more);
if (!(streams instanceof Array)) {
streams = [streams].concat(more);
}
if (streams.length) {

@@ -210,5 +223,5 @@ stream = (_.head(streams)).toProperty().map(function(x) {

});
_ref2 = _.tail(streams);
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
next = _ref2[_i];
_ref1 = _.tail(streams);
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
next = _ref1[_i];
stream = stream.combine(next, function(xs, x) {

@@ -303,3 +316,5 @@ return xs.concat([x]);

src.subscribe(function(event) {
if (event.hasValue()) return latest = event.value;
if (event.hasValue()) {
return latest = event.value;
}
});

@@ -400,3 +415,3 @@ return function() {

function Initial() {
Initial.__super__.constructor.apply(this, arguments);
return Initial.__super__.constructor.apply(this, arguments);
}

@@ -425,3 +440,3 @@

function End() {
End.__super__.constructor.apply(this, arguments);
return End.__super__.constructor.apply(this, arguments);
}

@@ -481,5 +496,9 @@

this.flatMapLatest = __bind(this.flatMapLatest, this);
this["switch"] = __bind(this["switch"], this);
this.scan = __bind(this.scan, this);
this.takeUntil = __bind(this.takeUntil, this); this.assign = this.onValue;
this.takeUntil = __bind(this.takeUntil, this);
this.assign = this.onValue;
}

@@ -492,3 +511,5 @@

return this.subscribe(function(event) {
if (event.hasValue()) return f(event.value);
if (event.hasValue()) {
return f(event.value);
}
});

@@ -508,3 +529,5 @@ };

return this.subscribe(function(event) {
if (event.isError()) return f(event.error);
if (event.isError()) {
return f(event.error);
}
});

@@ -518,3 +541,5 @@ };

return this.subscribe(function(event) {
if (event.isEnd()) return f();
if (event.isEnd()) {
return f();
}
});

@@ -616,3 +641,5 @@ };

return this.withHandler(function(event) {
if (event.hasValue()) f(event.value);
if (event.hasValue()) {
f(event.value);
}
return this.push(event);

@@ -645,3 +672,5 @@ });

reply = sink(event);
if (reply === Bacon.noMore) return unsubBoth();
if (reply === Bacon.noMore) {
return unsubBoth();
}
}

@@ -664,3 +693,5 @@ });

unsubSrc = src.subscribe(srcSink);
if (!unsubscribed) unsubStopper = stopper.subscribe(stopperSink);
if (!unsubscribed) {
unsubStopper = stopper.subscribe(stopperSink);
}
return unsubBoth;

@@ -719,3 +750,5 @@ });

reply = this.push(output);
if (reply === Bacon.noMore) return reply;
if (reply === Bacon.noMore) {
return reply;
}
}

@@ -744,3 +777,5 @@ return reply;

} else {
if (event.isEnd()) initSent = true;
if (event.isEnd()) {
initSent = true;
}
return sink(event);

@@ -782,3 +817,5 @@ }

checkEnd = function() {
if (rootEnd && (children.length === 0)) return sink(end());
if (rootEnd && (children.length === 0)) {
return sink(end());
}
};

@@ -797,3 +834,5 @@ spawner = function(event) {

removeChild = function() {
if (unsubChild != null) remove(unsubChild, children);
if (unsubChild != null) {
remove(unsubChild, children);
}
return checkEnd();

@@ -809,3 +848,5 @@ };

reply = sink(event);
if (reply === Bacon.noMore) unbind();
if (reply === Bacon.noMore) {
unbind();
}
return reply;

@@ -815,3 +856,5 @@ }

unsubChild = child.subscribe(handler);
if (!childEnded) return children.push(unsubChild);
if (!childEnded) {
return children.push(unsubChild);
}
}

@@ -953,3 +996,5 @@ };

values.push(event.value);
if (values.length === count) return flush();
if (values.length === count) {
return flush();
}
}

@@ -984,3 +1029,5 @@ });

reply = sink(event);
if (reply === Bacon.noMore) unsubBoth();
if (reply === Bacon.noMore) {
unsubBoth();
}
return reply;

@@ -990,3 +1037,5 @@ }

unsubLeft = left.subscribe(smartSink);
if (!unsubscribed) unsubRight = right.subscribe(smartSink);
if (!unsubscribed) {
unsubRight = right.subscribe(smartSink);
}
return unsubBoth;

@@ -997,3 +1046,5 @@ });

EventStream.prototype.toProperty = function(initValue) {
if (arguments.length === 0) initValue = None;
if (arguments.length === 0) {
initValue = None;
}
return this.scan(initValue, latter);

@@ -1075,5 +1126,9 @@ };

this.toEventStream = __bind(this.toEventStream, this);
this.toProperty = __bind(this.toProperty, this);
this.changes = __bind(this.changes, this);
this.sample = __bind(this.sample, this);
Property.__super__.constructor.call(this);

@@ -1100,3 +1155,5 @@ combine = function(other, leftSink, rightSink) {

reply = sink(end());
if (reply === Bacon.noMore) unsubBoth();
if (reply === Bacon.noMore) {
unsubBoth();
}
return reply;

@@ -1115,3 +1172,5 @@ }

reply = sink(event);
if (reply === Bacon.noMore) unsubBoth();
if (reply === Bacon.noMore) {
unsubBoth();
}
return reply;

@@ -1126,3 +1185,5 @@ } else {

reply = thisSink(sink, event, myVal.value, otherVal.value);
if (reply === Bacon.noMore) unsubBoth();
if (reply === Bacon.noMore) {
unsubBoth();
}
return reply;

@@ -1147,3 +1208,5 @@ }

unsubMe = _this.subscribe(mySink);
if (!unsubscribed) unsubOther = other.subscribe(otherSink);
if (!unsubscribed) {
unsubOther = other.subscribe(otherSink);
}
return unsubBoth;

@@ -1162,3 +1225,5 @@ });

var pushPropertyValue;
if (combinator == null) combinator = former;
if (combinator == null) {
combinator = former;
}
combinator = toCombinator(combinator);

@@ -1180,3 +1245,5 @@ pushPropertyValue = function(sink, event, propertyVal, streamVal) {

return _this.subscribe(function(event) {
if (!event.isInitial()) return sink(event);
if (!event.isInitial()) {
return sink(event);
}
});

@@ -1202,3 +1269,5 @@ });

return _this.subscribe(function(event) {
if (event.isInitial()) event = next(event.value);
if (event.isInitial()) {
event = next(event.value);
}
return sink(event);

@@ -1245,3 +1314,5 @@ });

property.subscribe(function(event) {
if (event.isInitial()) value = new Some(event.value);
if (event.isInitial()) {
value = new Some(event.value);
}
return Bacon.noMore;

@@ -1274,3 +1345,3 @@ });

this.push = function(event) {
var done, reply, sink, waiters, _i, _len, _ref2;
var done, reply, sink, waiters, _i, _len, _ref1;
waiters = void 0;

@@ -1297,7 +1368,9 @@ done = function() {

assertEvent(event);
_ref2 = cloneArray(sinks);
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
sink = _ref2[_i];
_ref1 = cloneArray(sinks);
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
sink = _ref1[_i];
reply = sink(event);
if (reply === Bacon.noMore || event.isEnd()) removeSink(sink);
if (reply === Bacon.noMore || event.isEnd()) {
removeSink(sink);
}
}

@@ -1318,3 +1391,5 @@ done();

assertEvent(event);
if (event.isEnd()) ended = true;
if (event.isEnd()) {
ended = true;
}
return handleEvent.apply(_this, [event]);

@@ -1335,3 +1410,5 @@ };

removeSink(sink);
if (!_this.hasSubscribers()) return unsubscribeFromSource();
if (!_this.hasSubscribers()) {
return unsubscribeFromSource();
}
};

@@ -1359,4 +1436,8 @@ }

this.push = function(event) {
if (event.isEnd()) ended = true;
if (event.hasValue()) current = new Some(event.value);
if (event.isEnd()) {
ended = true;
}
if (event.hasValue()) {
current = new Some(event.value);
}
return push.apply(_this, [event]);

@@ -1418,8 +1499,8 @@ };

subscribeAll = function(newSink) {
var input, _i, _len, _ref2;
var input, _i, _len, _ref1;
sink = newSink;
unsubFuncs = [];
_ref2 = cloneArray(inputs);
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
input = _ref2[_i];
_ref1 = cloneArray(inputs);
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
input = _ref1[_i];
unsubFuncs.push(input.subscribe(guardedSink(input)));

@@ -1435,3 +1516,5 @@ }

this.plug = function(inputStream) {
if (ended) return;
if (ended) {
return;
}
inputs.push(inputStream);

@@ -1443,6 +1526,10 @@ if ((sink != null)) {

this.push = function(value) {
if (sink != null) return sink(next(value));
if (sink != null) {
return sink(next(value));
}
};
this.error = function(error) {
if (sink != null) return sink(new Error(error));
if (sink != null) {
return sink(new Error(error));
}
};

@@ -1452,3 +1539,5 @@ this.end = function() {

unsubAll();
if (sink != null) return sink(end());
if (sink != null) {
return sink(end());
}
};

@@ -1585,7 +1674,11 @@ }

i = xs.indexOf(x);
if (i >= 0) return xs.splice(i, 1);
if (i >= 0) {
return xs.splice(i, 1);
}
};
assert = function(message, condition) {
if (!condition) throw message;
if (!condition) {
throw message;
}
};

@@ -1616,3 +1709,5 @@

assertString(method);
if (args === void 0) args = [];
if (args === void 0) {
args = [];
}
return function(value) {

@@ -1654,3 +1749,3 @@ return obj[method].apply(obj, args.concat([value]));

return function(value) {
var f, _i, _len;
var _i, _len;
for (_i = 0, _len = partFuncs.length; _i < _len; _i++) {

@@ -1670,3 +1765,3 @@ f = partFuncs[_i];

if (isFunction(fieldValue)) {
return fieldValue.apply(null, args);
return fieldValue.apply(value, args);
} else {

@@ -1733,3 +1828,5 @@ return fieldValue;

x = xs[_i];
if (f(x)) filtered.push(x);
if (f(x)) {
filtered.push(x);
}
}

@@ -1736,0 +1833,0 @@ return filtered;

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

((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=Array.prototype.slice,O=Object.prototype.hasOwnProperty,P=function(a,b){function d(){this.constructor=a}for(var c in b)O.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a},Q=function(a,b){return function(){return a.apply(b,arguments)}};(M=this.jQuery||this.Zepto)!=null&&(M.fn.asEventStream=function(b,c,d){var e;return d==null&&(d=L.id),w(c)&&(d=c,c=null),e=this,new g(function(f){var g,h;return g=function(){var b,c;b=1<=arguments.length?N.call(arguments,0):[],c=f(A(d.apply(null,b)));if(c===a.noMore)return h()},h=function(){return e.off(b,c,g)},e.on(b,c,g),h})}),a=this.Bacon={},a.fromPromise=function(b){return new a.EventStream(function(a){var c,f;return f=function(b){return a(new i(b)),a(new d)},c=function(b){return a(new e(b)),a(new d)},b.then(f,c),B})},a.noMore="veggies",a.more="moar bacon!",a.later=function(b,c){return a.sequentially(b,[c])},a.sequentially=function(b,c){var d,e;return d=-1,e=function(){return d++,d<c.length?G(c[d]):r()},a.fromPoll(b,e)},a.repeatedly=function(b,c){var d,e;return d=-1,e=function(){return d++,G(c[d%c.length])},a.fromPoll(b,e)},a.fromCallback=function(){var a,b;return b=arguments[0],a=2<=arguments.length?N.call(arguments,1):[],b=y(b,a),new g(function(a){var c;return c=function(b){return a(A(b)),a(r())},b(c),B})},a.fromPoll=function(b,c){return new g(function(d){var e,f,g;return f=void 0,e=function(){var b,e;e=c(),b=d(e);if(b===a.noMore||e.isEnd())return g()},g=function(){return clearInterval(f)},f=setInterval(e,b),g})},a.fromEventTarget=function(b,c){return new g(function(d){var e,f;return e=function(b){var c;c=d(A(b));if(c===a.noMore)return f()},b.addEventListener?(f=function(){return b.removeEventListener(c,e,!1)},b.addEventListener(c,e,!1)):(f=function(){return b.removeListener(c,e)},b.addListener(c,e)),f})},a.interval=function(b,c){var d;return c==null&&(c={}),d=function(){return A(c)},a.fromPoll(b,d)},a.constant=function(a){return new l(E([a],t))},a.never=function(){return a.fromArray([])},a.once=function(b){return a.fromArray([b])},a.fromArray=function(a){return new g(E(a,A))},E=function(a,b){return function(c){var d,e,f;for(e=0,f=a.length;e<f;e++)d=a[e],c(b(d));return c(r()),B}},a.combineAll=function(a,b){var c,d,e,f,g;d=L.head(a),g=L.tail(a);for(e=0,f=g.length;e<f;e++)c=g[e],d=b(d,c);return d},a.mergeAll=function(b){return a.combineAll(b,function(a,b){return a.merge(b)})},a.combineAsArray=function(){var b,c,d,e,f,g,h;e=arguments[0],b=2<=arguments.length?N.call(arguments,1):[],e instanceof Array||(e=[e].concat(b));if(e.length){d=L.head(e).toProperty().map(function(a){return[a]}),h=L.tail(e);for(f=0,g=h.length;f<g;f++)c=h[f],d=d.combine(c,function(a,b){return a.concat([b])});return d}return a.constant([])},a.combineWith=function(b,c){return a.combineAll(b,function(a,b){return a.toProperty().combine(b,c)})},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,d){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))):typeof b=="object"?(e=function(a){return function(c,d){var e;return e=j(b),l(c,a,e),c.push(e)}},d=function(a,b){return a.pop()},i.push(e(a)),f(b),i.push(d)):i.push(g(a,b))},f=function(a){return L.each(a,e)},f(b),d=function(a){var c,d,e,f,g;e=j(b),c=[e];for(f=0,g=i.length;f<g;f++)d=i[f],d(c,a);return e},a.combineAsArray(m).map(d)},a.latestValue=function(a){var b,c=this;return b=void 0,a.subscribe(function(a){if(a.hasValue())return b=a.value}),function(){return b}},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(a){return!0},a.prototype.getOriginalEvent=function(){return this.sourceEvent!=null?this.sourceEvent.getOriginalEvent():this},a.prototype.onDone=function(a){return a()},a}(),i=function(a){function b(a,b){this.value=a}return P(b,a),b.prototype.isNext=function(){return!0},b.prototype.hasValue=function(){return!0},b.prototype.fmap=function(a){return this.apply(a(this.value))},b.prototype.apply=function(a){return A(a,this.getOriginalEvent())},b.prototype.filter=function(a){return a(this.value)},b.prototype.describe=function(){return this.value},b}(f),h=function(a){function b(){b.__super__.constructor.apply(this,arguments)}return P(b,a),b.prototype.isInitial=function(){return!0},b.prototype.isNext=function(){return!1},b.prototype.apply=function(a){return t(a,this.getOriginalEvent())},b}(i),d=function(a){function b(){b.__super__.constructor.apply(this,arguments)}return P(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 P(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.flatMapLatest=Q(this.flatMapLatest,this),this["switch"]=Q(this["switch"],this),this.scan=Q(this.scan,this),this.takeUntil=Q(this.takeUntil,this),this.assign=this.onValue}return b.prototype.onValue=function(){var a,b;return b=arguments[0],a=2<=arguments.length?N.call(arguments,1):[],b=y(b,a),this.subscribe(function(a){if(a.hasValue())return b(a.value)})},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?N.call(arguments,1):[],b=y(b,a),this.subscribe(function(a){if(a.isError())return b(a.error)})},b.prototype.onEnd=function(){var a,b;return b=arguments[0],a=2<=arguments.length?N.call(arguments,1):[],b=y(b,a),this.subscribe(function(a){if(a.isEnd())return b()})},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?N.call(arguments,1):[],c=y(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?N.call(arguments,1):[],c=y(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 this.withHandler(function(c){return c.hasValue()?b===1?(this.push(c),this.push(r()),a.noMore):(b--,this.push(c)):this.push(c)})},b.prototype.map=function(){var a,b;return b=arguments[0],a=2<=arguments.length?N.call(arguments,1):[],b=y(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?N.call(arguments,1):[],b=y(b,a),this.withHandler(function(a){return a.isError()?this.push(A(b(a.error))):this.push(a)})},b.prototype["do"]=function(){var a;return a=1<=arguments.length?N.call(arguments,0):[],this.doAction.apply(this,a)},b.prototype.doAction=function(){var a,b;return b=arguments[0],a=2<=arguments.length?N.call(arguments,1):[],b=y(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=B,i=B,g=function(){return h(),i(),j=!0},e=function(b){return b.isEnd()?(i(),d(b),a.noMore):(b.getOriginalEvent().onDone(function(){var c;if(!j){c=d(b);if(c===a.noMore)return 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.distinctUntilChanged=function(){return this.skipDuplicates()},b.prototype.skipDuplicates=function(a){return a==null&&(a=function(a,b){return a===b}),this.withStateMachine(void 0,function(b,c){return c.hasValue()?a(b,c.value)?[b,[]]:[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;e=c(d,b),f=e[0],h=e[1],d=f,i=a.more;for(j=0,k=h.length;j<k;j++){g=h[j],i=this.push(g);if(i===a.noMore)return i}return i})},b.prototype.scan=function(b,c){var d,e,f=this;return c=F(c),d=J(b),e=function(b){var e,g;return e=!1,g=f.subscribe(function(f){return f.hasValue()?e&&f.isInitial()?a.more:(e=!0,d=new n(c(d.getOrElse(void 0),f.value)),b(f.apply(d.get()))):(f.isEnd()&&(e=!0),b(f))}),e||d.forEach(function(c){var d;d=b(t(c));if(d===a.noMore)return g(),g=B}),g},new l((new m(e)).subscribe)},b.prototype.flatMap=function(b){var c;return c=this,new g(function(d){var e,f,g,h,i,j;return f=[],g=!1,j=function(){},i=function(){var a,b,c;j();for(b=0,c=f.length;b<c;b++)a=f[b],a();return f=[]},e=function(){if(g&&f.length===0)return d(r())},h=function(c){var h,j,k,l,m;if(c.isEnd())return g=!0,e();if(c.isError())return d(c);h=b(c.value),m=void 0,j=!1,l=function(){return m!=null&&D(m,f),e()},k=function(b){var c;return b.isEnd()?(l(),j=!0,a.noMore):(c=d(b),c===a.noMore&&i(),c)},m=h.subscribe(k);if(!j)return f.push(m)},j=c.subscribe(h),i})},b.prototype["switch"]=function(){var a;return a=1<=arguments.length?N.call(arguments,0):[],this.flatMapLatest.apply(this,a)},b.prototype.flatMapLatest=function(a){var b,c=this;return 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(){return this.subscribe(function(a){return console.log(a.describe())}),this},b.prototype.slidingWindow=function(a){return this.scan([],function(b,c){return b.concat([c]).slice(-a)})},b}(),g=function(b){function d(a){var b;d.__super__.constructor.call(this),b=new c(a),this.subscribe=b.subscribe,this.hasSubscribers=b.hasSubscribers}return P(d,b),d.prototype.map=function(){var a,b;return b=arguments[0],a=2<=arguments.length?N.call(arguments,1):[],b instanceof l?b.sampledBy(this,s):d.__super__.map.apply(this,[b].concat(N.call(a)))},d.prototype.filter=function(){var a,b;return b=arguments[0],a=2<=arguments.length?N.call(arguments,1):[],b instanceof l?b.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}):d.__super__.filter.apply(this,[b].concat(N.call(a)))},d.prototype.delay=function(b){return this.flatMap(function(c){return a.later(b,c)})},d.prototype.throttle=function(b){return this.flatMapLatest(function(c){return a.later(b,c)})},d.prototype.bufferWithTime=function(b){var c,d,e,f;return f=[],e=function(a){return f.push(a),f.length===1},d=function(){var a;return a=f,f=[],a},c=function(){return a.later(b).map(d)},this.filter(e).flatMap(c)},d.prototype.bufferWithCount=function(a){var b;return b=[],this.withHandler(function(c){var d,e=this;d=function(){return e.push(A(b,c)),b=[]};if(c.isError())return this.push(c);if(c.isEnd())return d(),this.push(c);b.push(c.value);if(b.length===a)return d()})},d.prototype.merge=function(b){var c;return c=this,new d(function(d){var e,f,g,h,i,j;return h=B,i=B,j=!1,g=function(){return h(),i(),j=!0},e=0,f=function(b){var c;return b.isEnd()?(e++,e===2?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 arguments.length===0&&(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.startWith=function(b){return a.once(b).concat(this)},d.prototype.decorateWith=function(a,b){return b.sampledBy(this,function(b,c){var d;return d=q(c),d[a]=b,d})},d.prototype.mapEnd=function(){var b,c;return c=arguments[0],b=2<=arguments.length?N.call(arguments,1):[],c=y(c,b),this.withHandler(function(b){return b.isEnd()?(this.push(A(c(b))),this.push(r()),a.noMore):this.push(b)})},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){var d,e=this;this.subscribe=b,this.toEventStream=Q(this.toEventStream,this),this.toProperty=Q(this.toProperty,this),this.changes=Q(this.changes,this),this.sample=Q(this.sample,this),c.__super__.constructor.call(this),d=function(b,d,f){var g,h;return g=j,h=j,new c(function(c){var i,j,k,l,m,o,p,q,s,t,u;return u=!1,s=B,t=B,q=function(){return s(),t(),u=!0},l=!1,o=!1,i=function(){var b;if(l&&o)return b=c(r()),b===a.noMore&&q(),b},k=!1,j=function(b,d,e){return function(f){var j;return f.isEnd()?(b(),i(),a.noMore):f.isError()?(j=c(f),j===a.noMore&&q(),j):(d(new n(f.value)),g.isDefined&&h.isDefined?k&&f.isInitial()?a.more:(k=!0,j=e(c,f,g.value,h.value),j===a.noMore&&q(),j):a.more)}},m=j(function(){return l=!0},function(a){return g=a},d),p=j(function(){return o=!0},function(a){return h=a},f),s=e.subscribe(m),u||(t=b.subscribe(p)),q})},this.combine=function(a,b){var c,e;return c=F(b),e=function(a,b,d,e){return a(b.apply(c(d,e)))},d(a,e,e)},this.sampledBy=function(a,b){var c;return b==null&&(b=s),b=F(b),c=function(a,c,d,e){return a(c.apply(b(d,e)))},d(a,B,c).changes().takeUntil(a.filter(!1).mapEnd())}}return P(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){if(!a.isInitial())return b(a)})})},c.prototype.withHandler=function(a){return new c((new m(this.subscribe,a)).subscribe)},c.prototype.withSubscribe=function(a){return new c((new m(a)).subscribe)},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(a.value)),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.decode=function(b){return this.combine(a.combineTemplate(b),function(a,b){return b[a]})},c.prototype.delay=function(a){return o(this,this.changes().delay(a))},c.prototype.throttle=function(a){return o(this,this.changes().throttle(a))},c}(k),o=function(b,c){var d;return d=function(b){var c;return c=j,b.subscribe(function(b){return b.isInitial()&&(c=new n(b.value)),a.noMore}),c},c.toProperty(d(b))},c=function(){function b(b,c){var d,e,g,h,i=this;b==null&&(b=function(){return B}),g=[],d=!1,this.hasSubscribers=function(){return g.length>0},h=B,e=function(a){return D(a,g)},this.push=function(b){var c,d,h,j,k,l,m;j=void 0,c=function(){var a,c,d,e;if(j!=null){c=j,j=void 0;for(d=0,e=c.length;d<e;d++)a=c[d],a()}return b.onDone=f.prototype.onDone},b.onDone=function(a){return j!=null&&!L.contains(j,a)?j.push(a):j=[a]},m=p(g);for(k=0,l=m.length;k<l;k++)h=m[k],d=h(b),(d===a.noMore||b.isEnd())&&e(h);return c(),i.hasSubscribers()?a.more:a.noMore},c==null&&(c=function(a){return this.push(a)}),this.handleEvent=function(a){return a.isEnd()&&(d=!0),c.apply(i,[a])},this.subscribe=function(a){return d?(a(r()),B):(g.push(a),g.length===1&&(h=b(i.handleEvent)),function(){e(a);if(!i.hasSubscribers())return h()})}}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 n(a.value)),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(t(a))}),g.getOrElse(a.more)===a.noMore?B:f?(c(r()),B):b.apply(h,[c])}}return P(c,b),c}(c),b=function(b){function d(){var b,f,g,h,i,j,k,l,m,n=this;i=void 0,m=[],h=[],f=!1,g=function(b){return function(c){return c.isEnd()?(D(b,h),a.noMore):i(c)}},l=function(){var a,b,c;for(b=0,c=m.length;b<c;b++)a=m[b],a();return m=[]},j=function(a){var b,c,d,e;i=a,m=[],e=p(h);for(c=0,d=e.length;c<d;c++)b=e[c],m.push(b.subscribe(g(b)));return l},b=new c(j),k=function(a){return b.subscribe(a)},d.__super__.constructor.call(this,k),this.plug=function(a){if(f)return;h.push(a);if(i!=null)return m.push(a.subscribe(g(a)))},this.push=function(a){if(i!=null)return i(A(a))},this.error=function(a){if(i!=null)return i(new e(a))},this.end=function(){f=!0,l();if(i!=null)return i(r())}}return P(d,b),d}(g),n=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,B=function(){},x=function(a,b){return b},s=function(a,b){return a},t=function(a){return new h(a)},A=function(a){return new i(a)},r=function(){return new d},u=function(a){return a!=null&&a.isEvent!=null&&a.isEvent()},G=function(a){return u(a)?a:A(a)},p=function(a){return a.slice(0)},q=function(a){var b,c,d;b={};for(c in a)d=a[c],b[c]=d;return b},D=function(a,b){var c;c=b.indexOf(a);if(c>=0)return b.splice(c,1)},w=function(a){return typeof a=="function"},z=function(a,b,c){return c===void 0&&(c=[]),function(d){return a[b].apply(a,c.concat([d]))}},C=function(a,b){return function(c){return a.apply(null,b.concat([c]))}},y=function(a,b){return w(a)?b.length?C(a,b):a:v(a)?H(a,b):typeof a=="object"&&b.length?z(a,L.head(b),L.tail(b)):L.always(a)},v=function(a){return typeof a=="string"&&a.length>1&&a[0]==="."},H=function(a,b){var c,d;return d=a.slice(1).split("."),c=L.map(K(b),d),function(a){var b,d,e;for(d=0,e=c.length;d<e;d++)b=c[d],a=b(a);return a}},K=function(a){return function(b){return function(c){var d;return d=c[b],w(d)?d.apply(null,a):d}}},I=function(a){return a.slice(1)},F=function(a){var b;if(w(a))return a;if(v(a))return b=I(a),function(a,c){return a[b](c)}},J=function(a){return a instanceof n||a===j?a:new n(a)},typeof define!="undefined"&&define!==null&&define.amd!=null&&typeof define=="function"&&define(function(){return a}),L={head:function(a){return a[0]},always:function(a){return function(){return a}},empty:function(a){return a.length===0},tail:function(a){return a.slice(1,a.length)},filter:function(a,b){var c,d,e,f;c=[];for(e=0,f=b.length;e<f;e++)d=b[e],a(d)&&c.push(d);return c},map:function(a,b){var c,d,e,f;f=[];for(d=0,e=b.length;d<e;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},contains:function(a,b){return a.indexOf(b)>=0},id:function(a){return a},last:function(a){return a[a.length-1]}},a._=L})).call(this);
// Generated by CoffeeScript 1.3.3
((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=[].slice,O={}.hasOwnProperty,P=function(a,b){function d(){this.constructor=a}for(var c in b)O.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a},Q=function(a,b){return function(){return a.apply(b,arguments)}};(M=this.jQuery||this.Zepto)!=null&&(M.fn.asEventStream=function(b,c,d){var e;return d==null&&(d=L.id),w(c)&&(d=c,c=null),e=this,new g(function(f){var g,h;return g=function(){var b,c;b=1<=arguments.length?N.call(arguments,0):[],c=f(A(d.apply(null,b)));if(c===a.noMore)return h()},h=function(){return e.off(b,c,g)},e.on(b,c,g),h})}),a=this.Bacon={},a.fromPromise=function(b){return new a.EventStream(function(a){var c,f;return f=function(b){return a(new i(b)),a(new d)},c=function(b){return a(new e(b)),a(new d)},b.then(f,c),B})},a.noMore="veggies",a.more="moar bacon!",a.later=function(b,c){return a.sequentially(b,[c])},a.sequentially=function(b,c){var d,e;return d=-1,e=function(){return d++,d<c.length?G(c[d]):r()},a.fromPoll(b,e)},a.repeatedly=function(b,c){var d,e;return d=-1,e=function(){return d++,G(c[d%c.length])},a.fromPoll(b,e)},a.fromCallback=function(){var a,b;return b=arguments[0],a=2<=arguments.length?N.call(arguments,1):[],b=y(b,a),new g(function(a){var c;return c=function(b){return a(A(b)),a(r())},b(c),B})},a.fromPoll=function(b,c){return new g(function(d){var e,f,g;return f=void 0,e=function(){var b,e;e=c(),b=d(e);if(b===a.noMore||e.isEnd())return g()},g=function(){return clearInterval(f)},f=setInterval(e,b),g})},a.fromEventTarget=function(b,c){return new g(function(d){var e,f;return e=function(b){var c;c=d(A(b));if(c===a.noMore)return f()},b.addEventListener?(f=function(){return b.removeEventListener(c,e,!1)},b.addEventListener(c,e,!1)):(f=function(){return b.removeListener(c,e)},b.addListener(c,e)),f})},a.interval=function(b,c){var d;return c==null&&(c={}),d=function(){return A(c)},a.fromPoll(b,d)},a.constant=function(a){return new l(E([a],t))},a.never=function(){return a.fromArray([])},a.once=function(b){return a.fromArray([b])},a.fromArray=function(a){return new g(E(a,A))},E=function(a,b){return function(c){var d,e,f;for(e=0,f=a.length;e<f;e++)d=a[e],c(b(d));return c(r()),B}},a.combineAll=function(a,b){var c,d,e,f,g;d=L.head(a),g=L.tail(a);for(e=0,f=g.length;e<f;e++)c=g[e],d=b(d,c);return d},a.mergeAll=function(b){return a.combineAll(b,function(a,b){return a.merge(b)})},a.combineAsArray=function(){var b,c,d,e,f,g,h;e=arguments[0],b=2<=arguments.length?N.call(arguments,1):[],e instanceof Array||(e=[e].concat(b));if(e.length){d=L.head(e).toProperty().map(function(a){return[a]}),h=L.tail(e);for(f=0,g=h.length;f<g;f++)c=h[f],d=d.combine(c,function(a,b){return a.concat([b])});return d}return a.constant([])},a.combineWith=function(b,c){return a.combineAll(b,function(a,b){return a.toProperty().combine(b,c)})},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,d){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))):typeof b=="object"?(e=function(a){return function(c,d){var e;return e=j(b),l(c,a,e),c.push(e)}},d=function(a,b){return a.pop()},i.push(e(a)),f(b),i.push(d)):i.push(g(a,b))},f=function(a){return L.each(a,e)},f(b),d=function(a){var c,d,e,f,g;e=j(b),c=[e];for(f=0,g=i.length;f<g;f++)d=i[f],d(c,a);return e},a.combineAsArray(m).map(d)},a.latestValue=function(a){var b,c=this;return b=void 0,a.subscribe(function(a){if(a.hasValue())return b=a.value}),function(){return b}},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(a){return!0},a.prototype.getOriginalEvent=function(){return this.sourceEvent!=null?this.sourceEvent.getOriginalEvent():this},a.prototype.onDone=function(a){return a()},a}(),i=function(a){function b(a,b){this.value=a}return P(b,a),b.prototype.isNext=function(){return!0},b.prototype.hasValue=function(){return!0},b.prototype.fmap=function(a){return this.apply(a(this.value))},b.prototype.apply=function(a){return A(a,this.getOriginalEvent())},b.prototype.filter=function(a){return a(this.value)},b.prototype.describe=function(){return this.value},b}(f),h=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return P(b,a),b.prototype.isInitial=function(){return!0},b.prototype.isNext=function(){return!1},b.prototype.apply=function(a){return t(a,this.getOriginalEvent())},b}(i),d=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return P(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 P(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.flatMapLatest=Q(this.flatMapLatest,this),this["switch"]=Q(this["switch"],this),this.scan=Q(this.scan,this),this.takeUntil=Q(this.takeUntil,this),this.assign=this.onValue}return b.prototype.onValue=function(){var a,b;return b=arguments[0],a=2<=arguments.length?N.call(arguments,1):[],b=y(b,a),this.subscribe(function(a){if(a.hasValue())return b(a.value)})},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?N.call(arguments,1):[],b=y(b,a),this.subscribe(function(a){if(a.isError())return b(a.error)})},b.prototype.onEnd=function(){var a,b;return b=arguments[0],a=2<=arguments.length?N.call(arguments,1):[],b=y(b,a),this.subscribe(function(a){if(a.isEnd())return b()})},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?N.call(arguments,1):[],c=y(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?N.call(arguments,1):[],c=y(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 this.withHandler(function(c){return c.hasValue()?b===1?(this.push(c),this.push(r()),a.noMore):(b--,this.push(c)):this.push(c)})},b.prototype.map=function(){var a,b;return b=arguments[0],a=2<=arguments.length?N.call(arguments,1):[],b=y(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?N.call(arguments,1):[],b=y(b,a),this.withHandler(function(a){return a.isError()?this.push(A(b(a.error))):this.push(a)})},b.prototype["do"]=function(){var a;return a=1<=arguments.length?N.call(arguments,0):[],this.doAction.apply(this,a)},b.prototype.doAction=function(){var a,b;return b=arguments[0],a=2<=arguments.length?N.call(arguments,1):[],b=y(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=B,i=B,g=function(){return h(),i(),j=!0},e=function(b){return b.isEnd()?(i(),d(b),a.noMore):(b.getOriginalEvent().onDone(function(){var c;if(!j){c=d(b);if(c===a.noMore)return 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.distinctUntilChanged=function(){return this.skipDuplicates()},b.prototype.skipDuplicates=function(a){return a==null&&(a=function(a,b){return a===b}),this.withStateMachine(void 0,function(b,c){return c.hasValue()?a(b,c.value)?[b,[]]:[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;e=c(d,b),f=e[0],h=e[1],d=f,i=a.more;for(j=0,k=h.length;j<k;j++){g=h[j],i=this.push(g);if(i===a.noMore)return i}return i})},b.prototype.scan=function(b,c){var d,e,f=this;return c=F(c),d=J(b),e=function(b){var e,g;return e=!1,g=f.subscribe(function(f){return f.hasValue()?e&&f.isInitial()?a.more:(e=!0,d=new n(c(d.getOrElse(void 0),f.value)),b(f.apply(d.get()))):(f.isEnd()&&(e=!0),b(f))}),e||d.forEach(function(c){var d;d=b(t(c));if(d===a.noMore)return g(),g=B}),g},new l((new m(e)).subscribe)},b.prototype.flatMap=function(b){var c;return c=this,new g(function(d){var e,f,g,h,i,j;return f=[],g=!1,j=function(){},i=function(){var a,b,c;j();for(b=0,c=f.length;b<c;b++)a=f[b],a();return f=[]},e=function(){if(g&&f.length===0)return d(r())},h=function(c){var h,j,k,l,m;if(c.isEnd())return g=!0,e();if(c.isError())return d(c);h=b(c.value),m=void 0,j=!1,l=function(){return m!=null&&D(m,f),e()},k=function(b){var c;return b.isEnd()?(l(),j=!0,a.noMore):(c=d(b),c===a.noMore&&i(),c)},m=h.subscribe(k);if(!j)return f.push(m)},j=c.subscribe(h),i})},b.prototype["switch"]=function(){var a;return a=1<=arguments.length?N.call(arguments,0):[],this.flatMapLatest.apply(this,a)},b.prototype.flatMapLatest=function(a){var b,c=this;return 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(){return this.subscribe(function(a){return console.log(a.describe())}),this},b.prototype.slidingWindow=function(a){return this.scan([],function(b,c){return b.concat([c]).slice(-a)})},b}(),g=function(b){function d(a){var b;d.__super__.constructor.call(this),b=new c(a),this.subscribe=b.subscribe,this.hasSubscribers=b.hasSubscribers}return P(d,b),d.prototype.map=function(){var a,b;return b=arguments[0],a=2<=arguments.length?N.call(arguments,1):[],b instanceof l?b.sampledBy(this,s):d.__super__.map.apply(this,[b].concat(N.call(a)))},d.prototype.filter=function(){var a,b;return b=arguments[0],a=2<=arguments.length?N.call(arguments,1):[],b instanceof l?b.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}):d.__super__.filter.apply(this,[b].concat(N.call(a)))},d.prototype.delay=function(b){return this.flatMap(function(c){return a.later(b,c)})},d.prototype.throttle=function(b){return this.flatMapLatest(function(c){return a.later(b,c)})},d.prototype.bufferWithTime=function(b){var c,d,e,f;return f=[],e=function(a){return f.push(a),f.length===1},d=function(){var a;return a=f,f=[],a},c=function(){return a.later(b).map(d)},this.filter(e).flatMap(c)},d.prototype.bufferWithCount=function(a){var b;return b=[],this.withHandler(function(c){var d,e=this;d=function(){return e.push(A(b,c)),b=[]};if(c.isError())return this.push(c);if(c.isEnd())return d(),this.push(c);b.push(c.value);if(b.length===a)return d()})},d.prototype.merge=function(b){var c;return c=this,new d(function(d){var e,f,g,h,i,j;return h=B,i=B,j=!1,g=function(){return h(),i(),j=!0},e=0,f=function(b){var c;return b.isEnd()?(e++,e===2?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 arguments.length===0&&(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.startWith=function(b){return a.once(b).concat(this)},d.prototype.decorateWith=function(a,b){return b.sampledBy(this,function(b,c){var d;return d=q(c),d[a]=b,d})},d.prototype.mapEnd=function(){var b,c;return c=arguments[0],b=2<=arguments.length?N.call(arguments,1):[],c=y(c,b),this.withHandler(function(b){return b.isEnd()?(this.push(A(c(b))),this.push(r()),a.noMore):this.push(b)})},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){var d,e=this;this.subscribe=b,this.toEventStream=Q(this.toEventStream,this),this.toProperty=Q(this.toProperty,this),this.changes=Q(this.changes,this),this.sample=Q(this.sample,this),c.__super__.constructor.call(this),d=function(b,d,f){var g,h;return g=j,h=j,new c(function(c){var i,j,k,l,m,o,p,q,s,t,u;return u=!1,s=B,t=B,q=function(){return s(),t(),u=!0},l=!1,o=!1,i=function(){var b;if(l&&o)return b=c(r()),b===a.noMore&&q(),b},k=!1,j=function(b,d,e){return function(f){var j;return f.isEnd()?(b(),i(),a.noMore):f.isError()?(j=c(f),j===a.noMore&&q(),j):(d(new n(f.value)),g.isDefined&&h.isDefined?k&&f.isInitial()?a.more:(k=!0,j=e(c,f,g.value,h.value),j===a.noMore&&q(),j):a.more)}},m=j(function(){return l=!0},function(a){return g=a},d),p=j(function(){return o=!0},function(a){return h=a},f),s=e.subscribe(m),u||(t=b.subscribe(p)),q})},this.combine=function(a,b){var c,e;return c=F(b),e=function(a,b,d,e){return a(b.apply(c(d,e)))},d(a,e,e)},this.sampledBy=function(a,b){var c;return b==null&&(b=s),b=F(b),c=function(a,c,d,e){return a(c.apply(b(d,e)))},d(a,B,c).changes().takeUntil(a.filter(!1).mapEnd())}}return P(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){if(!a.isInitial())return b(a)})})},c.prototype.withHandler=function(a){return new c((new m(this.subscribe,a)).subscribe)},c.prototype.withSubscribe=function(a){return new c((new m(a)).subscribe)},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(a.value)),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.decode=function(b){return this.combine(a.combineTemplate(b),function(a,b){return b[a]})},c.prototype.delay=function(a){return o(this,this.changes().delay(a))},c.prototype.throttle=function(a){return o(this,this.changes().throttle(a))},c}(k),o=function(b,c){var d;return d=function(b){var c;return c=j,b.subscribe(function(b){return b.isInitial()&&(c=new n(b.value)),a.noMore}),c},c.toProperty(d(b))},c=function(){function b(b,c){var d,e,g,h,i=this;b==null&&(b=function(){return B}),g=[],d=!1,this.hasSubscribers=function(){return g.length>0},h=B,e=function(a){return D(a,g)},this.push=function(b){var c,d,h,j,k,l,m;j=void 0,c=function(){var a,c,d,e;if(j!=null){c=j,j=void 0;for(d=0,e=c.length;d<e;d++)a=c[d],a()}return b.onDone=f.prototype.onDone},b.onDone=function(a){return j!=null&&!L.contains(j,a)?j.push(a):j=[a]},m=p(g);for(k=0,l=m.length;k<l;k++)h=m[k],d=h(b),(d===a.noMore||b.isEnd())&&e(h);return c(),i.hasSubscribers()?a.more:a.noMore},c==null&&(c=function(a){return this.push(a)}),this.handleEvent=function(a){return a.isEnd()&&(d=!0),c.apply(i,[a])},this.subscribe=function(a){return d?(a(r()),B):(g.push(a),g.length===1&&(h=b(i.handleEvent)),function(){e(a);if(!i.hasSubscribers())return h()})}}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 n(a.value)),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(t(a))}),g.getOrElse(a.more)===a.noMore?B:f?(c(r()),B):b.apply(h,[c])}}return P(c,b),c}(c),b=function(b){function d(){var b,f,g,h,i,j,k,l,m,n=this;i=void 0,m=[],h=[],f=!1,g=function(b){return function(c){return c.isEnd()?(D(b,h),a.noMore):i(c)}},l=function(){var a,b,c;for(b=0,c=m.length;b<c;b++)a=m[b],a();return m=[]},j=function(a){var b,c,d,e;i=a,m=[],e=p(h);for(c=0,d=e.length;c<d;c++)b=e[c],m.push(b.subscribe(g(b)));return l},b=new c(j),k=function(a){return b.subscribe(a)},d.__super__.constructor.call(this,k),this.plug=function(a){if(f)return;h.push(a);if(i!=null)return m.push(a.subscribe(g(a)))},this.push=function(a){if(i!=null)return i(A(a))},this.error=function(a){if(i!=null)return i(new e(a))},this.end=function(){f=!0,l();if(i!=null)return i(r())}}return P(d,b),d}(g),n=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,B=function(){},x=function(a,b){return b},s=function(a,b){return a},t=function(a){return new h(a)},A=function(a){return new i(a)},r=function(){return new d},u=function(a){return a!=null&&a.isEvent!=null&&a.isEvent()},G=function(a){return u(a)?a:A(a)},p=function(a){return a.slice(0)},q=function(a){var b,c,d;b={};for(c in a)d=a[c],b[c]=d;return b},D=function(a,b){var c;c=b.indexOf(a);if(c>=0)return b.splice(c,1)},w=function(a){return typeof a=="function"},z=function(a,b,c){return c===void 0&&(c=[]),function(d){return a[b].apply(a,c.concat([d]))}},C=function(a,b){return function(c){return a.apply(null,b.concat([c]))}},y=function(a,b){return w(a)?b.length?C(a,b):a:v(a)?H(a,b):typeof a=="object"&&b.length?z(a,L.head(b),L.tail(b)):L.always(a)},v=function(a){return typeof a=="string"&&a.length>1&&a[0]==="."},H=function(a,b){var c,d;return d=a.slice(1).split("."),c=L.map(K(b),d),function(b){var d,e;for(d=0,e=c.length;d<e;d++)a=c[d],b=a(b);return b}},K=function(a){return function(b){return function(c){var d;return d=c[b],w(d)?d.apply(c,a):d}}},I=function(a){return a.slice(1)},F=function(a){var b;if(w(a))return a;if(v(a))return b=I(a),function(a,c){return a[b](c)}},J=function(a){return a instanceof n||a===j?a:new n(a)},typeof define!="undefined"&&define!==null&&define.amd!=null&&typeof define=="function"&&define(function(){return a}),L={head:function(a){return a[0]},always:function(a){return function(){return a}},empty:function(a){return a.length===0},tail:function(a){return a.slice(1,a.length)},filter:function(a,b){var c,d,e,f;c=[];for(e=0,f=b.length;e<f;e++)d=b[e],a(d)&&c.push(d);return c},map:function(a,b){var c,d,e,f;f=[];for(d=0,e=b.length;d<e;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},contains:function(a,b){return a.indexOf(b)>=0},id:function(a){return a},last:function(a){return a[a.length-1]}},a._=L})).call(this);
{
"name" : "baconjs",
"version" : "0.0.8",
"version" : "0.0.9",
"author" : "Juha Paananen",

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

@@ -129,2 +129,10 @@ Bacon.js

`Bacon.once(value)` creates an EventStream that delivers the given
single value for the first subscriber. The stream will end immediately
after this value.
`Bacon.fromArray(values)` creates an EventStream that delivers the given
series of values to the first subscriber. The stream ends after these
values have been delivered.
`Bacon.interval(interval, value)` repeats the single element

@@ -140,2 +148,4 @@ indefinitely with the given interval (in milliseconds)

`Bacon.never()` creates an EventStream that immediately ends.
`Bacon.fromEventTarget(target, event)` creates an EventStream from events

@@ -142,0 +152,0 @@ on a DOM EventTarget or Node.JS EventEmitter object.

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