Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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.4 to 0.0.5

browsertest/mocha.css

2

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

@@ -10,10 +10,18 @@ // Generated by CoffeeScript 1.3.3

if ((_ref = this.jQuery || this.Zepto) != null) {
_ref.fn.asEventStream = function(eventName, selector) {
_ref.fn.asEventStream = function(eventName, selector, eventTransformer) {
var element;
if (eventTransformer == null) {
eventTransformer = _.id;
}
if (isFunction(selector)) {
eventTransformer = selector;
selector = null;
}
element = this;
return new EventStream(function(sink) {
var handler, unbind;
handler = function(event) {
var reply;
reply = sink(next(event));
handler = function() {
var args, reply;
args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
reply = sink(next(eventTransformer.apply(null, args)));
if (reply === Bacon.noMore) {

@@ -82,2 +90,17 @@ return unbind();

Bacon.fromCallback = function() {
var args, f;
f = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
f = makeFunction(f, args);
return new EventStream(function(sink) {
var handler;
handler = function(value) {
sink(next(value));
return sink(end());
};
f(handler);
return nop;
});
};
Bacon.fromPoll = function(delay, poll) {

@@ -1674,2 +1697,5 @@ return new EventStream(function(sink) {

return xs.indexOf(x) >= 0;
},
id: function(x) {
return x;
}

@@ -1676,0 +1702,0 @@ };

// 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=[].slice,N={}.hasOwnProperty,O=function(a,b){function d(){this.constructor=a}for(var c in b)N.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a},P=function(a,b){return function(){return a.apply(b,arguments)}};(L=this.jQuery||this.Zepto)!=null&&(L.fn.asEventStream=function(b,c){var d;return d=this,new g(function(e){var f,g;return f=function(b){var c;c=e(z(b));if(c===a.noMore)return g()},g=function(){return d.off(b,c,f)},d.on(b,c,f),g})}),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),A})},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?F(c[d]):q()},a.fromPoll(b,e)},a.repeatedly=function(b,c){var d,e;return d=-1,e=function(){return d++,F(c[d%c.length])},a.fromPoll(b,e)},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(z(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 z(c)},a.fromPoll(b,d)},a.constant=function(a){return new l(D([a],s))},a.never=function(){return a.fromArray([])},a.once=function(b){return a.fromArray([b])},a.fromArray=function(a){return new g(D(a,z))},D=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(q()),A}},a.combineAll=function(a,b){var c,d,e,f,g;d=K.head(a),g=K.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?M.call(arguments,1):[],e instanceof Array||(e=[e].concat(b));if(e.length){d=K.head(e).toProperty().map(function(a){return[a]}),h=K.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;return h=[],j=[],g=function(a){return a[a.length-1]},i=function(a,b,c){return g(a)[b]=c},c=function(a,b){return function(c,d){return i(c,a,d[b])}},f=function(a,b){return function(c,d){return i(c,a,b)}},e=function(a){var b,d,g,l,m;m=[];for(b in a)l=a[b],l instanceof k?(j.push(l),m.push(h.push(c(b,j.length-1)))):typeof l=="object"?(g=function(a){return function(b,c){var d;return d={},i(b,a,d),b.push(d)}},d=function(a,b){return a.pop()},h.push(g(b)),e(l),m.push(h.push(d))):m.push(h.push(f(b,l)));return m},e(b),d=function(a){var b,c,d,e,f;d={},b=[d];for(e=0,f=h.length;e<f;e++)c=h[e],c(b,a);return d},a.combineAsArray(j).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 O(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 z(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 O(b,a),b.prototype.isInitial=function(){return!0},b.prototype.isNext=function(){return!1},b.prototype.apply=function(a){return s(a,this.getOriginalEvent())},b}(i),d=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return O(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 O(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["switch"]=P(this["switch"],this),this.takeUntil=P(this.takeUntil,this),this.assign=this.onValue}return b.prototype.onValue=function(){var a,b;return b=arguments[0],a=2<=arguments.length?M.call(arguments,1):[],b=x(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?M.call(arguments,1):[],b=x(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?M.call(arguments,1):[],b=x(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?M.call(arguments,1):[],c=x(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?M.call(arguments,1):[],c=x(c,b),this.withHandler(function(b){return b.filter(c)?this.push(b):(this.push(q()),a.noMore)})},b.prototype.endOnError=function(){return this.withHandler(function(a){return a.isError()?(this.push(a),this.push(q())):this.push(a)})},b.prototype.take=function(b){return this.withHandler(function(c){return c.hasValue()?b===1?(this.push(c),this.push(q()),a.noMore):(b--,this.push(c)):this.push(c)})},b.prototype.map=function(){var a,b;return b=arguments[0],a=2<=arguments.length?M.call(arguments,1):[],b=x(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?M.call(arguments,1):[],b=x(b,a),this.withHandler(function(a){return a.isError()?this.push(z(b(a.error))):this.push(a)})},b.prototype["do"]=function(){var a,b;return b=arguments[0],a=2<=arguments.length?M.call(arguments,1):[],b=x(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=A,i=A,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(q()),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(){return this.withStateMachine(void 0,function(a,b){return b.hasValue()?a!==b.value?[b.value,[b]]:[a,[]]:[a,[b]]})},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.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(q())},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&&C(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(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())}),void 0},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 O(d,b),d.prototype.map=function(){var a,b;return b=arguments[0],a=2<=arguments.length?M.call(arguments,1):[],b instanceof l?b.sampledBy(this,r):d.__super__.map.apply(this,[b].concat(M.call(a)))},d.prototype.filter=function(){var a,b;return b=arguments[0],a=2<=arguments.length?M.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(M.call(a)))},d.prototype.delay=function(b){return this.flatMap(function(c){return a.later(b,c)})},d.prototype.throttle=function(b){return this["switch"](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(z(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=A,i=A,j=!1,g=function(){return h(),i(),j=!0},e=0,f=function(b){var c;return b.isEnd()?(e++,e===2?d(q()):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,w)},d.prototype.toEventStream=function(){return this},d.prototype.scan=function(b,d){var e,f,g,h;return e=I(b),d=E(d),g=function(a){return a.hasValue()&&(e=new n(d(e.getOrElse(void 0),a.value))),this.push(a.apply(e.getOrElse(void 0)))},f=new c(this.subscribe,g),h=function(b){var c;return c=e.map(function(a){return b(s(a))}).getOrElse(a.more),c!==a.noMore?f.subscribe(b):A},new l(h)},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=p(c),d[a]=b,d})},d.prototype.mapEnd=function(){var b,c;return c=arguments[0],b=2<=arguments.length?M.call(arguments,1):[],c=x(c,b),this.withHandler(function(b){return b.isEnd()?(this.push(z(c(b))),this.push(q()),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=P(this.toEventStream,this),this.toProperty=P(this.toProperty,this),this.changes=P(this.changes,this),this.sample=P(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,r,s,t,u;return u=!1,s=A,t=A,r=function(){return s(),t(),u=!0},l=!1,o=!1,i=function(){var b;if(l&&o)return b=c(q()),b===a.noMore&&r(),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&&r(),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&&r(),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)),r})},this.combine=function(a,b){var c,e;return c=E(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=r),b=E(b),c=function(a,c,d,e){return a(c.apply(b(d,e)))},d(a,A,c).changes().takeUntil(a.filter(!1).mapEnd())}}return O(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=z(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}(k),c=function(){function b(b,c){var d,e,g,h=this;b==null&&(b=function(){return A}),e=[],this.hasSubscribers=function(){return e.length>0},g=A,d=function(a){return C(a,e)},this.push=function(b){var c,g,i,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&&!K.contains(j,a)?j.push(a):j=[a]},m=o(e);for(k=0,l=m.length;k<l;k++)i=m[k],g=i(b),(g===a.noMore||b.isEnd())&&d(i);return c(),h.hasSubscribers()?a.more:a.noMore},c==null&&(c=function(a){return this.push(a)}),this.handleEvent=function(a){return a.isEnd()&&(b=function(){return A}),c.apply(h,[a])},this.subscribe=function(a){return e.push(a),e.length===1&&(g=b(h.handleEvent)),function(){d(a);if(!h.hasSubscribers())return g()}}}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;return g=function(){return h.hasSubscribers()||f},d=e.filter(g).map(function(a){return c(s(a))}),d.getOrElse(a.more)===a.noMore?A:b.apply(h,[c])}}return O(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()?(C(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=o(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(z(a))},this.error=function(a){if(i!=null)return i(new e(a))},this.end=function(){f=!0,l();if(i!=null)return i(q())}}return O(d,b),d}(g),n=function(){function a(a){this.value=a}return a.prototype.getOrElse=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.isDefined=!0,a}(),j={getOrElse:function(a){return a},filter:function(){return j},map:function(){return j},isDefined:!1},a.EventStream=g,a.Property=l,a.Observable=k,a.Bus=b,a.Initial=h,a.Next=i,a.End=d,a.Error=e,A=function(){},w=function(a,b){return b},r=function(a,b){return a},s=function(a){return new h(a)},z=function(a){return new i(a)},q=function(){return new d},t=function(a){return a!=null&&a.isEvent!=null&&a.isEvent()},F=function(a){return t(a)?a:z(a)},o=function(a){return a.slice(0)},p=function(a){var b,c,d;b={};for(c in a)d=a[c],b[c]=d;return b},C=function(a,b){var c;c=b.indexOf(a);if(c>=0)return b.splice(c,1)},v=function(a){return typeof a=="function"},y=function(a,b,c){return c===void 0&&(c=[]),function(d){return a[b].apply(a,c.concat([d]))}},B=function(a,b){return function(c){return a.apply(null,b.concat([c]))}},x=function(a,b){return v(a)?b.length?B(a,b):a:u(a)?G(a,b):typeof a=="object"&&b.length?y(a,K.head(b),K.tail(b)):K.always(a)},u=function(a){return typeof a=="string"&&a.length>1&&a[0]==="."},G=function(a,b){var c,d;return d=a.slice(1).split("."),c=K.map(J(b),d),function(b){var d,e;for(d=0,e=c.length;d<e;d++)a=c[d],b=a(b);return b}},J=function(a){return function(b){return function(c){var d;return d=c[b],v(d)?d.apply(null,a):d}}},H=function(a){return a.slice(1)},E=function(a){var b;if(v(a))return a;if(u(a))return b=H(a),function(a,c){return a[b](c)}},I=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}),K={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},contains:function(a,b){return a.indexOf(b)>=0}},a._=K})).call(this);
((function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M=[].slice,N={}.hasOwnProperty,O=function(a,b){function d(){this.constructor=a}for(var c in b)N.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a},P=function(a,b){return function(){return a.apply(b,arguments)}};(L=this.jQuery||this.Zepto)!=null&&(L.fn.asEventStream=function(b,c,d){var e;return d==null&&(d=K.id),v(c)&&(d=c,c=null),e=this,new g(function(f){var g,h;return g=function(){var b,c;b=1<=arguments.length?M.call(arguments,0):[],c=f(z(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),A})},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?F(c[d]):q()},a.fromPoll(b,e)},a.repeatedly=function(b,c){var d,e;return d=-1,e=function(){return d++,F(c[d%c.length])},a.fromPoll(b,e)},a.fromCallback=function(){var a,b;return b=arguments[0],a=2<=arguments.length?M.call(arguments,1):[],b=x(b,a),new g(function(a){var c;return c=function(b){return a(z(b)),a(q())},b(c),A})},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(z(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 z(c)},a.fromPoll(b,d)},a.constant=function(a){return new l(D([a],s))},a.never=function(){return a.fromArray([])},a.once=function(b){return a.fromArray([b])},a.fromArray=function(a){return new g(D(a,z))},D=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(q()),A}},a.combineAll=function(a,b){var c,d,e,f,g;d=K.head(a),g=K.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?M.call(arguments,1):[],e instanceof Array||(e=[e].concat(b));if(e.length){d=K.head(e).toProperty().map(function(a){return[a]}),h=K.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;return h=[],j=[],g=function(a){return a[a.length-1]},i=function(a,b,c){return g(a)[b]=c},c=function(a,b){return function(c,d){return i(c,a,d[b])}},f=function(a,b){return function(c,d){return i(c,a,b)}},e=function(a){var b,d,g,l,m;m=[];for(b in a)l=a[b],l instanceof k?(j.push(l),m.push(h.push(c(b,j.length-1)))):typeof l=="object"?(g=function(a){return function(b,c){var d;return d={},i(b,a,d),b.push(d)}},d=function(a,b){return a.pop()},h.push(g(b)),e(l),m.push(h.push(d))):m.push(h.push(f(b,l)));return m},e(b),d=function(a){var b,c,d,e,f;d={},b=[d];for(e=0,f=h.length;e<f;e++)c=h[e],c(b,a);return d},a.combineAsArray(j).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 O(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 z(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 O(b,a),b.prototype.isInitial=function(){return!0},b.prototype.isNext=function(){return!1},b.prototype.apply=function(a){return s(a,this.getOriginalEvent())},b}(i),d=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return O(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 O(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["switch"]=P(this["switch"],this),this.takeUntil=P(this.takeUntil,this),this.assign=this.onValue}return b.prototype.onValue=function(){var a,b;return b=arguments[0],a=2<=arguments.length?M.call(arguments,1):[],b=x(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?M.call(arguments,1):[],b=x(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?M.call(arguments,1):[],b=x(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?M.call(arguments,1):[],c=x(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?M.call(arguments,1):[],c=x(c,b),this.withHandler(function(b){return b.filter(c)?this.push(b):(this.push(q()),a.noMore)})},b.prototype.endOnError=function(){return this.withHandler(function(a){return a.isError()?(this.push(a),this.push(q())):this.push(a)})},b.prototype.take=function(b){return this.withHandler(function(c){return c.hasValue()?b===1?(this.push(c),this.push(q()),a.noMore):(b--,this.push(c)):this.push(c)})},b.prototype.map=function(){var a,b;return b=arguments[0],a=2<=arguments.length?M.call(arguments,1):[],b=x(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?M.call(arguments,1):[],b=x(b,a),this.withHandler(function(a){return a.isError()?this.push(z(b(a.error))):this.push(a)})},b.prototype["do"]=function(){var a,b;return b=arguments[0],a=2<=arguments.length?M.call(arguments,1):[],b=x(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=A,i=A,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(q()),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(){return this.withStateMachine(void 0,function(a,b){return b.hasValue()?a!==b.value?[b.value,[b]]:[a,[]]:[a,[b]]})},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.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(q())},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&&C(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(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())}),void 0},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 O(d,b),d.prototype.map=function(){var a,b;return b=arguments[0],a=2<=arguments.length?M.call(arguments,1):[],b instanceof l?b.sampledBy(this,r):d.__super__.map.apply(this,[b].concat(M.call(a)))},d.prototype.filter=function(){var a,b;return b=arguments[0],a=2<=arguments.length?M.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(M.call(a)))},d.prototype.delay=function(b){return this.flatMap(function(c){return a.later(b,c)})},d.prototype.throttle=function(b){return this["switch"](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(z(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=A,i=A,j=!1,g=function(){return h(),i(),j=!0},e=0,f=function(b){var c;return b.isEnd()?(e++,e===2?d(q()):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,w)},d.prototype.toEventStream=function(){return this},d.prototype.scan=function(b,d){var e,f,g,h;return e=I(b),d=E(d),g=function(a){return a.hasValue()&&(e=new n(d(e.getOrElse(void 0),a.value))),this.push(a.apply(e.getOrElse(void 0)))},f=new c(this.subscribe,g),h=function(b){var c;return c=e.map(function(a){return b(s(a))}).getOrElse(a.more),c!==a.noMore?f.subscribe(b):A},new l(h)},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=p(c),d[a]=b,d})},d.prototype.mapEnd=function(){var b,c;return c=arguments[0],b=2<=arguments.length?M.call(arguments,1):[],c=x(c,b),this.withHandler(function(b){return b.isEnd()?(this.push(z(c(b))),this.push(q()),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=P(this.toEventStream,this),this.toProperty=P(this.toProperty,this),this.changes=P(this.changes,this),this.sample=P(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,r,s,t,u;return u=!1,s=A,t=A,r=function(){return s(),t(),u=!0},l=!1,o=!1,i=function(){var b;if(l&&o)return b=c(q()),b===a.noMore&&r(),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&&r(),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&&r(),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)),r})},this.combine=function(a,b){var c,e;return c=E(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=r),b=E(b),c=function(a,c,d,e){return a(c.apply(b(d,e)))},d(a,A,c).changes().takeUntil(a.filter(!1).mapEnd())}}return O(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=z(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}(k),c=function(){function b(b,c){var d,e,g,h=this;b==null&&(b=function(){return A}),e=[],this.hasSubscribers=function(){return e.length>0},g=A,d=function(a){return C(a,e)},this.push=function(b){var c,g,i,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&&!K.contains(j,a)?j.push(a):j=[a]},m=o(e);for(k=0,l=m.length;k<l;k++)i=m[k],g=i(b),(g===a.noMore||b.isEnd())&&d(i);return c(),h.hasSubscribers()?a.more:a.noMore},c==null&&(c=function(a){return this.push(a)}),this.handleEvent=function(a){return a.isEnd()&&(b=function(){return A}),c.apply(h,[a])},this.subscribe=function(a){return e.push(a),e.length===1&&(g=b(h.handleEvent)),function(){d(a);if(!h.hasSubscribers())return g()}}}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;return g=function(){return h.hasSubscribers()||f},d=e.filter(g).map(function(a){return c(s(a))}),d.getOrElse(a.more)===a.noMore?A:b.apply(h,[c])}}return O(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()?(C(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=o(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(z(a))},this.error=function(a){if(i!=null)return i(new e(a))},this.end=function(){f=!0,l();if(i!=null)return i(q())}}return O(d,b),d}(g),n=function(){function a(a){this.value=a}return a.prototype.getOrElse=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.isDefined=!0,a}(),j={getOrElse:function(a){return a},filter:function(){return j},map:function(){return j},isDefined:!1},a.EventStream=g,a.Property=l,a.Observable=k,a.Bus=b,a.Initial=h,a.Next=i,a.End=d,a.Error=e,A=function(){},w=function(a,b){return b},r=function(a,b){return a},s=function(a){return new h(a)},z=function(a){return new i(a)},q=function(){return new d},t=function(a){return a!=null&&a.isEvent!=null&&a.isEvent()},F=function(a){return t(a)?a:z(a)},o=function(a){return a.slice(0)},p=function(a){var b,c,d;b={};for(c in a)d=a[c],b[c]=d;return b},C=function(a,b){var c;c=b.indexOf(a);if(c>=0)return b.splice(c,1)},v=function(a){return typeof a=="function"},y=function(a,b,c){return c===void 0&&(c=[]),function(d){return a[b].apply(a,c.concat([d]))}},B=function(a,b){return function(c){return a.apply(null,b.concat([c]))}},x=function(a,b){return v(a)?b.length?B(a,b):a:u(a)?G(a,b):typeof a=="object"&&b.length?y(a,K.head(b),K.tail(b)):K.always(a)},u=function(a){return typeof a=="string"&&a.length>1&&a[0]==="."},G=function(a,b){var c,d;return d=a.slice(1).split("."),c=K.map(J(b),d),function(b){var d,e;for(d=0,e=c.length;d<e;d++)a=c[d],b=a(b);return b}},J=function(a){return function(b){return function(c){var d;return d=c[b],v(d)?d.apply(null,a):d}}},H=function(a){return a.slice(1)},E=function(a){var b;if(v(a))return a;if(u(a))return b=H(a),function(a,c){return a[b](c)}},I=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}),K={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},contains:function(a,b){return a.indexOf(b)>=0},id:function(a){return a}},a._=K})).call(this);
{
"name" : "baconjs",
"version" : "0.0.4",
"version" : "0.0.5",
"author" : "Juha Paananen",

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

@@ -100,3 +100,8 @@ Bacon.js

`$.asEventStream("click")` creates an EventStream from events on a
jQuery or Zepto.js object
jQuery or Zepto.js object. You can pass optional arguments to add a
jQuery live selector and/or a function that processes the jQuery
event and its parameters, if given, like this:
`$("#my-div").asEventStream("click", ".more-specific-selector")`
`$("#my-div").asEventStream("click", ".more-specific-selector", function(event, args) { return args[0] })`
`$("#my-div").asEventStream("click", function(event, args) { return args[0] })`

@@ -103,0 +108,0 @@ `Bacon.fromPromise(promise)` creates an EventStream from a Promise object such as JQuery Ajax. This stream will contain a single value or an error, followed immediately by stream end.

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