@cycle/xstream-adapter
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -79,2 +79,10 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.xstream = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
function noop() { } | ||
function copy(a) { | ||
var l = a.length; | ||
var b = Array(l); | ||
for (var i = 0; i < l; ++i) { | ||
b[i] = a[i]; | ||
} | ||
return b; | ||
} | ||
var emptyListener = { | ||
@@ -112,2 +120,7 @@ _n: noop, | ||
} | ||
function and(f1, f2) { | ||
return function andFn(t) { | ||
return f1(t) && f2(t); | ||
}; | ||
} | ||
var CombineListener = (function () { | ||
@@ -202,2 +215,3 @@ function CombineListener(i, prod) { | ||
}()); | ||
exports.FromArrayProducer = FromArrayProducer; | ||
var FromPromiseProducer = (function () { | ||
@@ -227,2 +241,3 @@ function FromPromiseProducer(p) { | ||
}()); | ||
exports.FromPromiseProducer = FromPromiseProducer; | ||
var MergeProducer = (function () { | ||
@@ -262,2 +277,3 @@ function MergeProducer(streams) { | ||
}()); | ||
exports.MergeProducer = MergeProducer; | ||
var PeriodicProducer = (function () { | ||
@@ -282,2 +298,3 @@ function PeriodicProducer(period) { | ||
}()); | ||
exports.PeriodicProducer = PeriodicProducer; | ||
var DebugOperator = (function () { | ||
@@ -320,2 +337,3 @@ function DebugOperator(spy, ins) { | ||
}()); | ||
exports.DebugOperator = DebugOperator; | ||
var DropOperator = (function () { | ||
@@ -349,2 +367,3 @@ function DropOperator(max, ins) { | ||
}()); | ||
exports.DropOperator = DropOperator; | ||
var OtherListener = (function () { | ||
@@ -399,2 +418,3 @@ function OtherListener(out, op) { | ||
}()); | ||
exports.EndWhenOperator = EndWhenOperator; | ||
var FilterOperator = (function () { | ||
@@ -431,2 +451,3 @@ function FilterOperator(passes, ins) { | ||
}()); | ||
exports.FilterOperator = FilterOperator; | ||
var FCInner = (function () { | ||
@@ -576,2 +597,3 @@ function FCInner(out, op) { | ||
}()); | ||
exports.FoldOperator = FoldOperator; | ||
var LastOperator = (function () { | ||
@@ -613,2 +635,3 @@ function LastOperator(ins) { | ||
}()); | ||
exports.LastOperator = LastOperator; | ||
var MFCInner = (function () { | ||
@@ -667,2 +690,3 @@ function MFCInner(out, op) { | ||
}()); | ||
exports.MapFlattenConcOperator = MapFlattenConcOperator; | ||
var MFInner = (function () { | ||
@@ -733,2 +757,3 @@ function MFInner(out, op) { | ||
}()); | ||
exports.MapFlattenOperator = MapFlattenOperator; | ||
var MapOperator = (function () { | ||
@@ -764,2 +789,3 @@ function MapOperator(project, ins) { | ||
}()); | ||
exports.MapOperator = MapOperator; | ||
var FilterMapOperator = (function (_super) { | ||
@@ -779,2 +805,3 @@ __extends(FilterMapOperator, _super); | ||
}(MapOperator)); | ||
exports.FilterMapOperator = FilterMapOperator; | ||
var MapToOperator = (function () { | ||
@@ -805,2 +832,3 @@ function MapToOperator(val, ins) { | ||
}()); | ||
exports.MapToOperator = MapToOperator; | ||
var ReplaceErrorOperator = (function () { | ||
@@ -837,2 +865,3 @@ function ReplaceErrorOperator(fn, ins) { | ||
}()); | ||
exports.ReplaceErrorOperator = ReplaceErrorOperator; | ||
var StartWithOperator = (function () { | ||
@@ -855,2 +884,3 @@ function StartWithOperator(ins, value) { | ||
}()); | ||
exports.StartWithOperator = StartWithOperator; | ||
var TakeOperator = (function () { | ||
@@ -874,2 +904,4 @@ function TakeOperator(max, ins) { | ||
var out = this.out; | ||
if (!out) | ||
return; | ||
if (this.taken++ < this.max - 1) { | ||
@@ -885,9 +917,16 @@ out._n(t); | ||
TakeOperator.prototype._e = function (err) { | ||
this.out._e(err); | ||
var out = this.out; | ||
if (!out) | ||
return; | ||
out._e(err); | ||
}; | ||
TakeOperator.prototype._c = function () { | ||
this.out._c(); | ||
var out = this.out; | ||
if (!out) | ||
return; | ||
out._c(); | ||
}; | ||
return TakeOperator; | ||
}()); | ||
exports.TakeOperator = TakeOperator; | ||
var Stream = (function () { | ||
@@ -938,10 +977,9 @@ function Stream(producer) { | ||
var a = this._ils; | ||
var len = a.length; | ||
if (len === 1) { | ||
var L = a.length; | ||
if (L == 1) | ||
a[0]._n(t); | ||
} | ||
else { | ||
for (var i = 0; i < len; i++) { | ||
a[i]._n(t); | ||
} | ||
var b = copy(a); | ||
for (var i = 0; i < L; i++) | ||
b[i]._n(t); | ||
} | ||
@@ -951,10 +989,9 @@ }; | ||
var a = this._ils; | ||
var len = a.length; | ||
if (len === 1) { | ||
var L = a.length; | ||
if (L == 1) | ||
a[0]._e(err); | ||
} | ||
else { | ||
for (var i = 0; i < len; i++) { | ||
a[i]._e(err); | ||
} | ||
var b = copy(a); | ||
for (var i = 0; i < L; i++) | ||
b[i]._e(err); | ||
} | ||
@@ -965,10 +1002,9 @@ this._x(); | ||
var a = this._ils; | ||
var len = a.length; | ||
if (len === 1) { | ||
var L = a.length; | ||
if (L == 1) | ||
a[0]._c(); | ||
} | ||
else { | ||
for (var i = 0; i < len; i++) { | ||
a[i]._c(); | ||
} | ||
var b = copy(a); | ||
for (var i = 0; i < L; i++) | ||
b[i]._c(); | ||
} | ||
@@ -990,2 +1026,8 @@ this._x(); | ||
Stream.prototype.addListener = function (listener) { | ||
if (typeof listener.next !== 'function' | ||
|| typeof listener.error !== 'function' | ||
|| typeof listener.complete !== 'function') { | ||
throw new Error('stream.addListener() requires all three next, error, ' + | ||
'and complete functions.'); | ||
} | ||
listener._n = listener.next; | ||
@@ -1294,10 +1336,4 @@ listener._e = listener.error; | ||
var p = this._prod; | ||
if (p instanceof MapOperator) { | ||
return new Stream(new FilterMapOperator(passes, p.project, p.ins)); | ||
} | ||
if (p instanceof FilterMapOperator) { | ||
return new Stream(new FilterMapOperator(compose2(passes, p.passes), p.project, p.ins)); | ||
} | ||
if (p instanceof FilterOperator) { | ||
return new Stream(new FilterOperator(compose2(passes, p.passes), p.ins)); | ||
return new Stream(new FilterOperator(and(passes, p.passes), p.ins)); | ||
} | ||
@@ -1304,0 +1340,0 @@ return new Stream(new FilterOperator(passes, this)); |
@@ -1,1 +0,1 @@ | ||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.xstream=f()}})(function(){var define,module,exports;return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){"use strict";var xstream_1=require("xstream");function logToConsoleError(err){var target=err.stack||err;if(console&&console.error){console.error(target)}else if(console&&console.log){console.log(target)}}var XStreamAdapter={adapt:function(originStream,originStreamSubscribe){if(XStreamAdapter.isValidStream(originStream)){return originStream}var dispose=null;return xstream_1.default.create({start:function(out){var observer={next:function(value){return out.shamefullySendNext(value)},error:function(err){return out.shamefullySendError(err)},complete:function(){return out.shamefullySendComplete()}};dispose=originStreamSubscribe(originStream,observer)},stop:function(){if(typeof dispose==="function"){dispose()}}})},dispose:function(sinks,sinkProxies,sources){Object.keys(sources).forEach(function(k){if(typeof sources[k].dispose==="function"){sources[k].dispose()}});Object.keys(sinkProxies).forEach(function(k){sinkProxies[k].observer.complete()})},makeHoldSubject:function(){var stream=xstream_1.default.createWithMemory();var observer={next:function(x){stream.shamefullySendNext(x)},error:function(err){logToConsoleError(err);stream.shamefullySendError(err)},complete:function(){stream.shamefullySendComplete()}};return{observer:observer,stream:stream}},isValidStream:function(stream){return typeof stream.addListener==="function"&&typeof stream.imitate==="function"},streamSubscribe:function(stream,observer){stream.addListener(observer);return function(){return stream.removeListener(observer)}}};Object.defineProperty(exports,"__esModule",{value:true});exports.default=XStreamAdapter},{xstream:3}],2:[function(require,module,exports){"use strict";var __extends=this&&this.__extends||function(d,b){for(var p in b)if(b.hasOwnProperty(p))d[p]=b[p];function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)};var empty={};function noop(){}var emptyListener={_n:noop,_e:noop,_c:noop};function internalizeProducer(producer){producer._start=function _start(il){il.next=il._n;il.error=il._e;il.complete=il._c;this.start(il)};producer._stop=producer.stop}function invoke(f,args){switch(args.length){case 0:return f();case 1:return f(args[0]);case 2:return f(args[0],args[1]);case 3:return f(args[0],args[1],args[2]);case 4:return f(args[0],args[1],args[2],args[3]);case 5:return f(args[0],args[1],args[2],args[3],args[4]);default:return f.apply(void 0,args)}}function compose2(f1,f2){return function composedFn(arg){return f1(f2(arg))}}var CombineListener=function(){function CombineListener(i,prod){this.i=i;this.prod=prod;prod.proxies.push(this)}CombineListener.prototype._n=function(t){var prod=this.prod;var vals=prod.vals;prod.hasVal[this.i]=true;vals[this.i]=t;if(!prod.ready){prod.up()}if(prod.ready){try{prod.out._n(invoke(prod.project,vals))}catch(e){prod.out._e(e)}}};CombineListener.prototype._e=function(err){this.prod.out._e(err)};CombineListener.prototype._c=function(){var prod=this.prod;if(--prod.ac===0){prod.out._c()}};return CombineListener}();var CombineProducer=function(){function CombineProducer(project,streams){this.project=project;this.streams=streams;this.out=emptyListener;this.proxies=[];this.ready=false;this.vals=new Array(streams.length);this.hasVal=new Array(streams.length);this.ac=streams.length}CombineProducer.prototype.up=function(){for(var i=this.hasVal.length-1;i>=0;i--){if(!this.hasVal[i]){return}}this.ready=true};CombineProducer.prototype._start=function(out){this.out=out;var streams=this.streams;for(var i=streams.length-1;i>=0;i--){streams[i]._add(new CombineListener(i,this))}};CombineProducer.prototype._stop=function(){var streams=this.streams;for(var i=streams.length-1;i>=0;i--){streams[i]._remove(this.proxies[i])}this.out=null;this.ac=streams.length;this.proxies=[];this.ready=false;this.vals=new Array(streams.length);this.hasVal=new Array(streams.length)};return CombineProducer}();var FromArrayProducer=function(){function FromArrayProducer(a){this.a=a}FromArrayProducer.prototype._start=function(out){var a=this.a;for(var i=0,l=a.length;i<l;i++){out._n(a[i])}out._c()};FromArrayProducer.prototype._stop=function(){};return FromArrayProducer}();var FromPromiseProducer=function(){function FromPromiseProducer(p){this.p=p;this.on=false}FromPromiseProducer.prototype._start=function(out){var prod=this;this.on=true;this.p.then(function(v){if(prod.on){out._n(v);out._c()}},function(e){out._e(e)}).then(null,function(err){setTimeout(function(){throw err})})};FromPromiseProducer.prototype._stop=function(){this.on=false};return FromPromiseProducer}();var MergeProducer=function(){function MergeProducer(streams){this.streams=streams;this.out=emptyListener;this.ac=streams.length}MergeProducer.prototype._start=function(out){this.out=out;var streams=this.streams;for(var i=streams.length-1;i>=0;i--){streams[i]._add(this)}};MergeProducer.prototype._stop=function(){var streams=this.streams;for(var i=streams.length-1;i>=0;i--){streams[i]._remove(this)}this.out=null;this.ac=streams.length};MergeProducer.prototype._n=function(t){this.out._n(t)};MergeProducer.prototype._e=function(err){this.out._e(err)};MergeProducer.prototype._c=function(){if(--this.ac===0){this.out._c()}};return MergeProducer}();var PeriodicProducer=function(){function PeriodicProducer(period){this.period=period;this.intervalID=-1;this.i=0}PeriodicProducer.prototype._start=function(stream){var self=this;function intervalHandler(){stream._n(self.i++)}this.intervalID=setInterval(intervalHandler,this.period)};PeriodicProducer.prototype._stop=function(){if(this.intervalID!==-1)clearInterval(this.intervalID);this.intervalID=-1;this.i=0};return PeriodicProducer}();var DebugOperator=function(){function DebugOperator(spy,ins){if(spy===void 0){spy=null}this.spy=spy;this.ins=ins;this.out=null}DebugOperator.prototype._start=function(out){this.out=out;this.ins._add(this)};DebugOperator.prototype._stop=function(){this.ins._remove(this);this.out=null};DebugOperator.prototype._n=function(t){if(this.spy){try{this.spy(t)}catch(e){this.out._e(e)}}else{console.log(t)}this.out._n(t)};DebugOperator.prototype._e=function(err){this.out._e(err)};DebugOperator.prototype._c=function(){this.out._c()};return DebugOperator}();var DropOperator=function(){function DropOperator(max,ins){this.max=max;this.ins=ins;this.out=null;this.dropped=0}DropOperator.prototype._start=function(out){this.out=out;this.ins._add(this)};DropOperator.prototype._stop=function(){this.ins._remove(this);this.out=null;this.dropped=0};DropOperator.prototype._n=function(t){if(this.dropped++>=this.max)this.out._n(t)};DropOperator.prototype._e=function(err){this.out._e(err)};DropOperator.prototype._c=function(){this.out._c()};return DropOperator}();var OtherListener=function(){function OtherListener(out,op){this.out=out;this.op=op}OtherListener.prototype._n=function(t){this.op.end()};OtherListener.prototype._e=function(err){this.out._e(err)};OtherListener.prototype._c=function(){this.op.end()};return OtherListener}();var EndWhenOperator=function(){function EndWhenOperator(o,ins){this.o=o;this.ins=ins;this.out=null;this.oli=emptyListener}EndWhenOperator.prototype._start=function(out){this.out=out;this.o._add(this.oli=new OtherListener(out,this));this.ins._add(this)};EndWhenOperator.prototype._stop=function(){this.ins._remove(this);this.o._remove(this.oli);this.out=null;this.oli=null};EndWhenOperator.prototype.end=function(){this.out._c()};EndWhenOperator.prototype._n=function(t){this.out._n(t)};EndWhenOperator.prototype._e=function(err){this.out._e(err)};EndWhenOperator.prototype._c=function(){this.end()};return EndWhenOperator}();var FilterOperator=function(){function FilterOperator(passes,ins){this.passes=passes;this.ins=ins;this.out=null}FilterOperator.prototype._start=function(out){this.out=out;this.ins._add(this)};FilterOperator.prototype._stop=function(){this.ins._remove(this);this.out=null};FilterOperator.prototype._n=function(t){try{if(this.passes(t))this.out._n(t)}catch(e){this.out._e(e)}};FilterOperator.prototype._e=function(err){this.out._e(err)};FilterOperator.prototype._c=function(){this.out._c()};return FilterOperator}();var FCInner=function(){function FCInner(out,op){this.out=out;this.op=op}FCInner.prototype._n=function(t){this.out._n(t)};FCInner.prototype._e=function(err){this.out._e(err)};FCInner.prototype._c=function(){this.op.less()};return FCInner}();var FlattenConcOperator=function(){function FlattenConcOperator(ins){this.ins=ins;this.active=1;this.out=null}FlattenConcOperator.prototype._start=function(out){this.out=out;this.ins._add(this)};FlattenConcOperator.prototype._stop=function(){this.ins._remove(this);this.active=1;this.out=null};FlattenConcOperator.prototype.less=function(){if(--this.active===0){this.out._c()}};FlattenConcOperator.prototype._n=function(s){this.active++;s._add(new FCInner(this.out,this))};FlattenConcOperator.prototype._e=function(err){this.out._e(err)};FlattenConcOperator.prototype._c=function(){this.less()};return FlattenConcOperator}();exports.FlattenConcOperator=FlattenConcOperator;var FInner=function(){function FInner(out,op){this.out=out;this.op=op}FInner.prototype._n=function(t){this.out._n(t)};FInner.prototype._e=function(err){this.out._e(err)};FInner.prototype._c=function(){this.op.curr=null;this.op.less()};return FInner}();var FlattenOperator=function(){function FlattenOperator(ins){this.ins=ins;this.curr=null;this.inner=null;this.open=true;this.out=null}FlattenOperator.prototype._start=function(out){this.out=out;this.ins._add(this)};FlattenOperator.prototype._stop=function(){this.ins._remove(this);this.curr=null;this.inner=null;this.open=true;this.out=null};FlattenOperator.prototype.cut=function(){var _a=this,curr=_a.curr,inner=_a.inner;if(curr&&inner){curr._remove(inner)}};FlattenOperator.prototype.less=function(){if(!this.open&&!this.curr){this.out._c()}};FlattenOperator.prototype._n=function(s){this.cut();(this.curr=s)._add(this.inner=new FInner(this.out,this))};FlattenOperator.prototype._e=function(err){this.out._e(err)};FlattenOperator.prototype._c=function(){this.open=false;this.less()};return FlattenOperator}();exports.FlattenOperator=FlattenOperator;var FoldOperator=function(){function FoldOperator(f,seed,ins){this.f=f;this.seed=seed;this.ins=ins;this.out=null;this.acc=seed}FoldOperator.prototype._start=function(out){this.out=out;out._n(this.acc);this.ins._add(this)};FoldOperator.prototype._stop=function(){this.ins._remove(this);this.out=null;this.acc=this.seed};FoldOperator.prototype._n=function(t){try{this.out._n(this.acc=this.f(this.acc,t))}catch(e){this.out._e(e)}};FoldOperator.prototype._e=function(err){this.out._e(err)};FoldOperator.prototype._c=function(){this.out._c()};return FoldOperator}();var LastOperator=function(){function LastOperator(ins){this.ins=ins;this.out=null;this.has=false;this.val=empty}LastOperator.prototype._start=function(out){this.out=out;this.ins._add(this)};LastOperator.prototype._stop=function(){this.ins._remove(this);this.out=null;this.has=false;this.val=empty};LastOperator.prototype._n=function(t){this.has=true;this.val=t};LastOperator.prototype._e=function(err){this.out._e(err)};LastOperator.prototype._c=function(){var out=this.out;if(this.has){out._n(this.val);out._c()}else{out._e("TODO show proper error")}};return LastOperator}();var MFCInner=function(){function MFCInner(out,op){this.out=out;this.op=op}MFCInner.prototype._n=function(t){this.out._n(t)};MFCInner.prototype._e=function(err){this.out._e(err)};MFCInner.prototype._c=function(){this.op.less()};return MFCInner}();var MapFlattenConcOperator=function(){function MapFlattenConcOperator(mapOp){this.mapOp=mapOp;this.active=1;this.out=null}MapFlattenConcOperator.prototype._start=function(out){this.out=out;this.mapOp.ins._add(this)};MapFlattenConcOperator.prototype._stop=function(){this.mapOp.ins._remove(this);this.active=1;this.out=null};MapFlattenConcOperator.prototype.less=function(){if(--this.active===0){this.out._c()}};MapFlattenConcOperator.prototype._n=function(v){this.active++;try{this.mapOp.project(v)._add(new MFCInner(this.out,this))}catch(e){this.out._e(e)}};MapFlattenConcOperator.prototype._e=function(err){this.out._e(err)};MapFlattenConcOperator.prototype._c=function(){this.less()};return MapFlattenConcOperator}();var MFInner=function(){function MFInner(out,op){this.out=out;this.op=op}MFInner.prototype._n=function(t){this.out._n(t)};MFInner.prototype._e=function(err){this.out._e(err)};MFInner.prototype._c=function(){this.op.curr=null;this.op.less()};return MFInner}();var MapFlattenOperator=function(){function MapFlattenOperator(mapOp){this.mapOp=mapOp;this.curr=null;this.inner=null;this.open=true;this.out=null}MapFlattenOperator.prototype._start=function(out){this.out=out;this.mapOp.ins._add(this)};MapFlattenOperator.prototype._stop=function(){this.mapOp.ins._remove(this);this.curr=null;this.inner=null;this.open=true;this.out=null};MapFlattenOperator.prototype.cut=function(){var _a=this,curr=_a.curr,inner=_a.inner;if(curr&&inner){curr._remove(inner)}};MapFlattenOperator.prototype.less=function(){if(!this.open&&!this.curr){this.out._c()}};MapFlattenOperator.prototype._n=function(v){this.cut();try{(this.curr=this.mapOp.project(v))._add(this.inner=new MFInner(this.out,this))}catch(e){this.out._e(e)}};MapFlattenOperator.prototype._e=function(err){this.out._e(err)};MapFlattenOperator.prototype._c=function(){this.open=false;this.less()};return MapFlattenOperator}();var MapOperator=function(){function MapOperator(project,ins){this.project=project;this.ins=ins;this.out=null}MapOperator.prototype._start=function(out){this.out=out;this.ins._add(this)};MapOperator.prototype._stop=function(){this.ins._remove(this);this.out=null};MapOperator.prototype._n=function(t){try{this.out._n(this.project(t))}catch(e){this.out._e(e)}};MapOperator.prototype._e=function(err){this.out._e(err)};MapOperator.prototype._c=function(){this.out._c()};return MapOperator}();var FilterMapOperator=function(_super){__extends(FilterMapOperator,_super);function FilterMapOperator(passes,project,ins){_super.call(this,project,ins);this.passes=passes}FilterMapOperator.prototype._n=function(v){if(this.passes(v)){_super.prototype._n.call(this,v)}};return FilterMapOperator}(MapOperator);var MapToOperator=function(){function MapToOperator(val,ins){this.val=val;this.ins=ins;this.out=null}MapToOperator.prototype._start=function(out){this.out=out;this.ins._add(this)};MapToOperator.prototype._stop=function(){this.ins._remove(this);this.out=null};MapToOperator.prototype._n=function(t){this.out._n(this.val)};MapToOperator.prototype._e=function(err){this.out._e(err)};MapToOperator.prototype._c=function(){this.out._c()};return MapToOperator}();var ReplaceErrorOperator=function(){function ReplaceErrorOperator(fn,ins){this.fn=fn;this.ins=ins;this.out=empty}ReplaceErrorOperator.prototype._start=function(out){this.out=out;this.ins._add(this)};ReplaceErrorOperator.prototype._stop=function(){this.ins._remove(this);this.out=null};ReplaceErrorOperator.prototype._n=function(t){this.out._n(t)};ReplaceErrorOperator.prototype._e=function(err){try{this.ins._remove(this);(this.ins=this.fn(err))._add(this)}catch(e){this.out._e(e)}};ReplaceErrorOperator.prototype._c=function(){this.out._c()};return ReplaceErrorOperator}();var StartWithOperator=function(){function StartWithOperator(ins,value){this.ins=ins;this.value=value;this.out=emptyListener}StartWithOperator.prototype._start=function(out){this.out=out;this.out._n(this.value);this.ins._add(out)};StartWithOperator.prototype._stop=function(){this.ins._remove(this.out);this.out=null};return StartWithOperator}();var TakeOperator=function(){function TakeOperator(max,ins){this.max=max;this.ins=ins;this.out=null;this.taken=0}TakeOperator.prototype._start=function(out){this.out=out;this.ins._add(this)};TakeOperator.prototype._stop=function(){this.ins._remove(this);this.out=null;this.taken=0};TakeOperator.prototype._n=function(t){var out=this.out;if(this.taken++<this.max-1){out._n(t)}else{out._n(t);out._c();this._stop()}};TakeOperator.prototype._e=function(err){this.out._e(err)};TakeOperator.prototype._c=function(){this.out._c()};return TakeOperator}();var Stream=function(){function Stream(producer){this._stopID=empty;this.combine=function combine(project){var streams=[];for(var _i=1;_i<arguments.length;_i++){streams[_i-1]=arguments[_i]}streams.unshift(this);return Stream.combine.apply(Stream,[project].concat(streams))};this._prod=producer;this._ils=[]}Stream.prototype._n=function(t){var a=this._ils;var len=a.length;if(len===1){a[0]._n(t)}else{for(var i=0;i<len;i++){a[i]._n(t)}}};Stream.prototype._e=function(err){var a=this._ils;var len=a.length;if(len===1){a[0]._e(err)}else{for(var i=0;i<len;i++){a[i]._e(err)}}this._x()};Stream.prototype._c=function(){var a=this._ils;var len=a.length;if(len===1){a[0]._c()}else{for(var i=0;i<len;i++){a[i]._c()}}this._x()};Stream.prototype._x=function(){if(this._ils.length===0)return;if(this._prod)this._prod._stop();this._ils=[]};Stream.prototype.addListener=function(listener){listener._n=listener.next;listener._e=listener.error;listener._c=listener.complete;this._add(listener)};Stream.prototype.removeListener=function(listener){this._remove(listener)};Stream.prototype._add=function(il){var a=this._ils;a.push(il);if(a.length===1){if(this._stopID!==empty){clearTimeout(this._stopID);this._stopID=empty}var p=this._prod;if(p)p._start(this)}};Stream.prototype._remove=function(il){var a=this._ils;var i=a.indexOf(il);if(i>-1){a.splice(i,1);var p_1=this._prod;if(p_1&&a.length<=0){this._stopID=setTimeout(function(){return p_1._stop()})}}};Stream.create=function(producer){if(producer){internalizeProducer(producer)}return new Stream(producer)};Stream.createWithMemory=function(producer){if(producer){internalizeProducer(producer)}return new MemoryStream(producer)};Stream.never=function(){return new Stream({_start:noop,_stop:noop})};Stream.empty=function(){return new Stream({_start:function(il){il._c()},_stop:noop})};Stream.throw=function(error){return new Stream({_start:function(il){il._e(error)},_stop:noop})};Stream.of=function(){var items=[];for(var _i=0;_i<arguments.length;_i++){items[_i-0]=arguments[_i]}return Stream.fromArray(items)};Stream.fromArray=function(array){return new Stream(new FromArrayProducer(array))};Stream.fromPromise=function(promise){return new Stream(new FromPromiseProducer(promise))};Stream.periodic=function(period){return new Stream(new PeriodicProducer(period))};Stream.merge=function(){var streams=[];for(var _i=0;_i<arguments.length;_i++){streams[_i-0]=arguments[_i]}return new Stream(new MergeProducer(streams))};Stream.prototype.map=function(project){var p=this._prod;if(p instanceof FilterOperator){return new Stream(new FilterMapOperator(p.passes,project,p.ins))}if(p instanceof FilterMapOperator){return new Stream(new FilterMapOperator(p.passes,compose2(project,p.project),p.ins))}if(p instanceof MapOperator){return new Stream(new MapOperator(compose2(project,p.project),p.ins))}return new Stream(new MapOperator(project,this))};Stream.prototype.mapTo=function(projectedValue){return new Stream(new MapToOperator(projectedValue,this))};Stream.prototype.filter=function(passes){var p=this._prod;if(p instanceof MapOperator){return new Stream(new FilterMapOperator(passes,p.project,p.ins))}if(p instanceof FilterMapOperator){return new Stream(new FilterMapOperator(compose2(passes,p.passes),p.project,p.ins))}if(p instanceof FilterOperator){return new Stream(new FilterOperator(compose2(passes,p.passes),p.ins))}return new Stream(new FilterOperator(passes,this))};Stream.prototype.take=function(amount){return new Stream(new TakeOperator(amount,this))};Stream.prototype.drop=function(amount){return new Stream(new DropOperator(amount,this))};Stream.prototype.last=function(){return new Stream(new LastOperator(this))};Stream.prototype.startWith=function(initial){return new Stream(new StartWithOperator(this,initial))};Stream.prototype.endWhen=function(other){return new Stream(new EndWhenOperator(other,this))};Stream.prototype.fold=function(accumulate,seed){return new Stream(new FoldOperator(accumulate,seed,this))};Stream.prototype.replaceError=function(replace){return new Stream(new ReplaceErrorOperator(replace,this))};Stream.prototype.flatten=function(){var p=this._prod;return new Stream(p instanceof MapOperator||p instanceof FilterMapOperator?new MapFlattenOperator(p):new FlattenOperator(this))};Stream.prototype.flattenConcurrently=function(){var p=this._prod;return new Stream(p instanceof MapOperator||p instanceof FilterMapOperator?new MapFlattenConcOperator(p):new FlattenConcOperator(this))};Stream.prototype.merge=function(other){return Stream.merge(this,other)};Stream.prototype.compose=function(operator){return operator(this)};Stream.prototype.remember=function(){return new MemoryStream(this._prod)};Stream.prototype.imitate=function(other){other._add(this)};Stream.prototype.debug=function(spy){if(spy===void 0){spy=null}return new Stream(new DebugOperator(spy,this))};Stream.prototype.shamefullySendNext=function(value){this._n(value)};Stream.prototype.shamefullySendError=function(error){this._e(error)};Stream.prototype.shamefullySendComplete=function(){this._c()};Stream.combine=function combine(project){var streams=[];for(var _i=1;_i<arguments.length;_i++){streams[_i-1]=arguments[_i]}return new Stream(new CombineProducer(project,streams))};return Stream}();exports.Stream=Stream;var MemoryStream=function(_super){__extends(MemoryStream,_super);function MemoryStream(producer){_super.call(this,producer);this._has=false}MemoryStream.prototype._n=function(x){this._val=x;this._has=true;_super.prototype._n.call(this,x)};MemoryStream.prototype._add=function(listener){if(this._has){listener._n(this._val)}_super.prototype._add.call(this,listener)};return MemoryStream}(Stream);exports.MemoryStream=MemoryStream;Object.defineProperty(exports,"__esModule",{value:true});exports.default=Stream},{}],3:[function(require,module,exports){"use strict";var core_1=require("./core");exports.Stream=core_1.Stream;exports.MemoryStream=core_1.MemoryStream;Object.defineProperty(exports,"__esModule",{value:true});exports.default=core_1.Stream},{"./core":2}]},{},[1])(1)}); | ||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.xstream=f()}})(function(){var define,module,exports;return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){"use strict";var xstream_1=require("xstream");function logToConsoleError(err){var target=err.stack||err;if(console&&console.error){console.error(target)}else if(console&&console.log){console.log(target)}}var XStreamAdapter={adapt:function(originStream,originStreamSubscribe){if(XStreamAdapter.isValidStream(originStream)){return originStream}var dispose=null;return xstream_1.default.create({start:function(out){var observer={next:function(value){return out.shamefullySendNext(value)},error:function(err){return out.shamefullySendError(err)},complete:function(){return out.shamefullySendComplete()}};dispose=originStreamSubscribe(originStream,observer)},stop:function(){if(typeof dispose==="function"){dispose()}}})},dispose:function(sinks,sinkProxies,sources){Object.keys(sources).forEach(function(k){if(typeof sources[k].dispose==="function"){sources[k].dispose()}});Object.keys(sinkProxies).forEach(function(k){sinkProxies[k].observer.complete()})},makeHoldSubject:function(){var stream=xstream_1.default.createWithMemory();var observer={next:function(x){stream.shamefullySendNext(x)},error:function(err){logToConsoleError(err);stream.shamefullySendError(err)},complete:function(){stream.shamefullySendComplete()}};return{observer:observer,stream:stream}},isValidStream:function(stream){return typeof stream.addListener==="function"&&typeof stream.imitate==="function"},streamSubscribe:function(stream,observer){stream.addListener(observer);return function(){return stream.removeListener(observer)}}};Object.defineProperty(exports,"__esModule",{value:true});exports.default=XStreamAdapter},{xstream:3}],2:[function(require,module,exports){"use strict";var __extends=this&&this.__extends||function(d,b){for(var p in b)if(b.hasOwnProperty(p))d[p]=b[p];function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)};var empty={};function noop(){}function copy(a){var l=a.length;var b=Array(l);for(var i=0;i<l;++i){b[i]=a[i]}return b}var emptyListener={_n:noop,_e:noop,_c:noop};function internalizeProducer(producer){producer._start=function _start(il){il.next=il._n;il.error=il._e;il.complete=il._c;this.start(il)};producer._stop=producer.stop}function invoke(f,args){switch(args.length){case 0:return f();case 1:return f(args[0]);case 2:return f(args[0],args[1]);case 3:return f(args[0],args[1],args[2]);case 4:return f(args[0],args[1],args[2],args[3]);case 5:return f(args[0],args[1],args[2],args[3],args[4]);default:return f.apply(void 0,args)}}function compose2(f1,f2){return function composedFn(arg){return f1(f2(arg))}}function and(f1,f2){return function andFn(t){return f1(t)&&f2(t)}}var CombineListener=function(){function CombineListener(i,prod){this.i=i;this.prod=prod;prod.proxies.push(this)}CombineListener.prototype._n=function(t){var prod=this.prod;var vals=prod.vals;prod.hasVal[this.i]=true;vals[this.i]=t;if(!prod.ready){prod.up()}if(prod.ready){try{prod.out._n(invoke(prod.project,vals))}catch(e){prod.out._e(e)}}};CombineListener.prototype._e=function(err){this.prod.out._e(err)};CombineListener.prototype._c=function(){var prod=this.prod;if(--prod.ac===0){prod.out._c()}};return CombineListener}();var CombineProducer=function(){function CombineProducer(project,streams){this.project=project;this.streams=streams;this.out=emptyListener;this.proxies=[];this.ready=false;this.vals=new Array(streams.length);this.hasVal=new Array(streams.length);this.ac=streams.length}CombineProducer.prototype.up=function(){for(var i=this.hasVal.length-1;i>=0;i--){if(!this.hasVal[i]){return}}this.ready=true};CombineProducer.prototype._start=function(out){this.out=out;var streams=this.streams;for(var i=streams.length-1;i>=0;i--){streams[i]._add(new CombineListener(i,this))}};CombineProducer.prototype._stop=function(){var streams=this.streams;for(var i=streams.length-1;i>=0;i--){streams[i]._remove(this.proxies[i])}this.out=null;this.ac=streams.length;this.proxies=[];this.ready=false;this.vals=new Array(streams.length);this.hasVal=new Array(streams.length)};return CombineProducer}();var FromArrayProducer=function(){function FromArrayProducer(a){this.a=a}FromArrayProducer.prototype._start=function(out){var a=this.a;for(var i=0,l=a.length;i<l;i++){out._n(a[i])}out._c()};FromArrayProducer.prototype._stop=function(){};return FromArrayProducer}();exports.FromArrayProducer=FromArrayProducer;var FromPromiseProducer=function(){function FromPromiseProducer(p){this.p=p;this.on=false}FromPromiseProducer.prototype._start=function(out){var prod=this;this.on=true;this.p.then(function(v){if(prod.on){out._n(v);out._c()}},function(e){out._e(e)}).then(null,function(err){setTimeout(function(){throw err})})};FromPromiseProducer.prototype._stop=function(){this.on=false};return FromPromiseProducer}();exports.FromPromiseProducer=FromPromiseProducer;var MergeProducer=function(){function MergeProducer(streams){this.streams=streams;this.out=emptyListener;this.ac=streams.length}MergeProducer.prototype._start=function(out){this.out=out;var streams=this.streams;for(var i=streams.length-1;i>=0;i--){streams[i]._add(this)}};MergeProducer.prototype._stop=function(){var streams=this.streams;for(var i=streams.length-1;i>=0;i--){streams[i]._remove(this)}this.out=null;this.ac=streams.length};MergeProducer.prototype._n=function(t){this.out._n(t)};MergeProducer.prototype._e=function(err){this.out._e(err)};MergeProducer.prototype._c=function(){if(--this.ac===0){this.out._c()}};return MergeProducer}();exports.MergeProducer=MergeProducer;var PeriodicProducer=function(){function PeriodicProducer(period){this.period=period;this.intervalID=-1;this.i=0}PeriodicProducer.prototype._start=function(stream){var self=this;function intervalHandler(){stream._n(self.i++)}this.intervalID=setInterval(intervalHandler,this.period)};PeriodicProducer.prototype._stop=function(){if(this.intervalID!==-1)clearInterval(this.intervalID);this.intervalID=-1;this.i=0};return PeriodicProducer}();exports.PeriodicProducer=PeriodicProducer;var DebugOperator=function(){function DebugOperator(spy,ins){if(spy===void 0){spy=null}this.spy=spy;this.ins=ins;this.out=null}DebugOperator.prototype._start=function(out){this.out=out;this.ins._add(this)};DebugOperator.prototype._stop=function(){this.ins._remove(this);this.out=null};DebugOperator.prototype._n=function(t){if(this.spy){try{this.spy(t)}catch(e){this.out._e(e)}}else{console.log(t)}this.out._n(t)};DebugOperator.prototype._e=function(err){this.out._e(err)};DebugOperator.prototype._c=function(){this.out._c()};return DebugOperator}();exports.DebugOperator=DebugOperator;var DropOperator=function(){function DropOperator(max,ins){this.max=max;this.ins=ins;this.out=null;this.dropped=0}DropOperator.prototype._start=function(out){this.out=out;this.ins._add(this)};DropOperator.prototype._stop=function(){this.ins._remove(this);this.out=null;this.dropped=0};DropOperator.prototype._n=function(t){if(this.dropped++>=this.max)this.out._n(t)};DropOperator.prototype._e=function(err){this.out._e(err)};DropOperator.prototype._c=function(){this.out._c()};return DropOperator}();exports.DropOperator=DropOperator;var OtherListener=function(){function OtherListener(out,op){this.out=out;this.op=op}OtherListener.prototype._n=function(t){this.op.end()};OtherListener.prototype._e=function(err){this.out._e(err)};OtherListener.prototype._c=function(){this.op.end()};return OtherListener}();var EndWhenOperator=function(){function EndWhenOperator(o,ins){this.o=o;this.ins=ins;this.out=null;this.oli=emptyListener}EndWhenOperator.prototype._start=function(out){this.out=out;this.o._add(this.oli=new OtherListener(out,this));this.ins._add(this)};EndWhenOperator.prototype._stop=function(){this.ins._remove(this);this.o._remove(this.oli);this.out=null;this.oli=null};EndWhenOperator.prototype.end=function(){this.out._c()};EndWhenOperator.prototype._n=function(t){this.out._n(t)};EndWhenOperator.prototype._e=function(err){this.out._e(err)};EndWhenOperator.prototype._c=function(){this.end()};return EndWhenOperator}();exports.EndWhenOperator=EndWhenOperator;var FilterOperator=function(){function FilterOperator(passes,ins){this.passes=passes;this.ins=ins;this.out=null}FilterOperator.prototype._start=function(out){this.out=out;this.ins._add(this)};FilterOperator.prototype._stop=function(){this.ins._remove(this);this.out=null};FilterOperator.prototype._n=function(t){try{if(this.passes(t))this.out._n(t)}catch(e){this.out._e(e)}};FilterOperator.prototype._e=function(err){this.out._e(err)};FilterOperator.prototype._c=function(){this.out._c()};return FilterOperator}();exports.FilterOperator=FilterOperator;var FCInner=function(){function FCInner(out,op){this.out=out;this.op=op}FCInner.prototype._n=function(t){this.out._n(t)};FCInner.prototype._e=function(err){this.out._e(err)};FCInner.prototype._c=function(){this.op.less()};return FCInner}();var FlattenConcOperator=function(){function FlattenConcOperator(ins){this.ins=ins;this.active=1;this.out=null}FlattenConcOperator.prototype._start=function(out){this.out=out;this.ins._add(this)};FlattenConcOperator.prototype._stop=function(){this.ins._remove(this);this.active=1;this.out=null};FlattenConcOperator.prototype.less=function(){if(--this.active===0){this.out._c()}};FlattenConcOperator.prototype._n=function(s){this.active++;s._add(new FCInner(this.out,this))};FlattenConcOperator.prototype._e=function(err){this.out._e(err)};FlattenConcOperator.prototype._c=function(){this.less()};return FlattenConcOperator}();exports.FlattenConcOperator=FlattenConcOperator;var FInner=function(){function FInner(out,op){this.out=out;this.op=op}FInner.prototype._n=function(t){this.out._n(t)};FInner.prototype._e=function(err){this.out._e(err)};FInner.prototype._c=function(){this.op.curr=null;this.op.less()};return FInner}();var FlattenOperator=function(){function FlattenOperator(ins){this.ins=ins;this.curr=null;this.inner=null;this.open=true;this.out=null}FlattenOperator.prototype._start=function(out){this.out=out;this.ins._add(this)};FlattenOperator.prototype._stop=function(){this.ins._remove(this);this.curr=null;this.inner=null;this.open=true;this.out=null};FlattenOperator.prototype.cut=function(){var _a=this,curr=_a.curr,inner=_a.inner;if(curr&&inner){curr._remove(inner)}};FlattenOperator.prototype.less=function(){if(!this.open&&!this.curr){this.out._c()}};FlattenOperator.prototype._n=function(s){this.cut();(this.curr=s)._add(this.inner=new FInner(this.out,this))};FlattenOperator.prototype._e=function(err){this.out._e(err)};FlattenOperator.prototype._c=function(){this.open=false;this.less()};return FlattenOperator}();exports.FlattenOperator=FlattenOperator;var FoldOperator=function(){function FoldOperator(f,seed,ins){this.f=f;this.seed=seed;this.ins=ins;this.out=null;this.acc=seed}FoldOperator.prototype._start=function(out){this.out=out;out._n(this.acc);this.ins._add(this)};FoldOperator.prototype._stop=function(){this.ins._remove(this);this.out=null;this.acc=this.seed};FoldOperator.prototype._n=function(t){try{this.out._n(this.acc=this.f(this.acc,t))}catch(e){this.out._e(e)}};FoldOperator.prototype._e=function(err){this.out._e(err)};FoldOperator.prototype._c=function(){this.out._c()};return FoldOperator}();exports.FoldOperator=FoldOperator;var LastOperator=function(){function LastOperator(ins){this.ins=ins;this.out=null;this.has=false;this.val=empty}LastOperator.prototype._start=function(out){this.out=out;this.ins._add(this)};LastOperator.prototype._stop=function(){this.ins._remove(this);this.out=null;this.has=false;this.val=empty};LastOperator.prototype._n=function(t){this.has=true;this.val=t};LastOperator.prototype._e=function(err){this.out._e(err)};LastOperator.prototype._c=function(){var out=this.out;if(this.has){out._n(this.val);out._c()}else{out._e("TODO show proper error")}};return LastOperator}();exports.LastOperator=LastOperator;var MFCInner=function(){function MFCInner(out,op){this.out=out;this.op=op}MFCInner.prototype._n=function(t){this.out._n(t)};MFCInner.prototype._e=function(err){this.out._e(err)};MFCInner.prototype._c=function(){this.op.less()};return MFCInner}();var MapFlattenConcOperator=function(){function MapFlattenConcOperator(mapOp){this.mapOp=mapOp;this.active=1;this.out=null}MapFlattenConcOperator.prototype._start=function(out){this.out=out;this.mapOp.ins._add(this)};MapFlattenConcOperator.prototype._stop=function(){this.mapOp.ins._remove(this);this.active=1;this.out=null};MapFlattenConcOperator.prototype.less=function(){if(--this.active===0){this.out._c()}};MapFlattenConcOperator.prototype._n=function(v){this.active++;try{this.mapOp.project(v)._add(new MFCInner(this.out,this))}catch(e){this.out._e(e)}};MapFlattenConcOperator.prototype._e=function(err){this.out._e(err)};MapFlattenConcOperator.prototype._c=function(){this.less()};return MapFlattenConcOperator}();exports.MapFlattenConcOperator=MapFlattenConcOperator;var MFInner=function(){function MFInner(out,op){this.out=out;this.op=op}MFInner.prototype._n=function(t){this.out._n(t)};MFInner.prototype._e=function(err){this.out._e(err)};MFInner.prototype._c=function(){this.op.curr=null;this.op.less()};return MFInner}();var MapFlattenOperator=function(){function MapFlattenOperator(mapOp){this.mapOp=mapOp;this.curr=null;this.inner=null;this.open=true;this.out=null}MapFlattenOperator.prototype._start=function(out){this.out=out;this.mapOp.ins._add(this)};MapFlattenOperator.prototype._stop=function(){this.mapOp.ins._remove(this);this.curr=null;this.inner=null;this.open=true;this.out=null};MapFlattenOperator.prototype.cut=function(){var _a=this,curr=_a.curr,inner=_a.inner;if(curr&&inner){curr._remove(inner)}};MapFlattenOperator.prototype.less=function(){if(!this.open&&!this.curr){this.out._c()}};MapFlattenOperator.prototype._n=function(v){this.cut();try{(this.curr=this.mapOp.project(v))._add(this.inner=new MFInner(this.out,this))}catch(e){this.out._e(e)}};MapFlattenOperator.prototype._e=function(err){this.out._e(err)};MapFlattenOperator.prototype._c=function(){this.open=false;this.less()};return MapFlattenOperator}();exports.MapFlattenOperator=MapFlattenOperator;var MapOperator=function(){function MapOperator(project,ins){this.project=project;this.ins=ins;this.out=null}MapOperator.prototype._start=function(out){this.out=out;this.ins._add(this)};MapOperator.prototype._stop=function(){this.ins._remove(this);this.out=null};MapOperator.prototype._n=function(t){try{this.out._n(this.project(t))}catch(e){this.out._e(e)}};MapOperator.prototype._e=function(err){this.out._e(err)};MapOperator.prototype._c=function(){this.out._c()};return MapOperator}();exports.MapOperator=MapOperator;var FilterMapOperator=function(_super){__extends(FilterMapOperator,_super);function FilterMapOperator(passes,project,ins){_super.call(this,project,ins);this.passes=passes}FilterMapOperator.prototype._n=function(v){if(this.passes(v)){_super.prototype._n.call(this,v)}};return FilterMapOperator}(MapOperator);exports.FilterMapOperator=FilterMapOperator;var MapToOperator=function(){function MapToOperator(val,ins){this.val=val;this.ins=ins;this.out=null}MapToOperator.prototype._start=function(out){this.out=out;this.ins._add(this)};MapToOperator.prototype._stop=function(){this.ins._remove(this);this.out=null};MapToOperator.prototype._n=function(t){this.out._n(this.val)};MapToOperator.prototype._e=function(err){this.out._e(err)};MapToOperator.prototype._c=function(){this.out._c()};return MapToOperator}();exports.MapToOperator=MapToOperator;var ReplaceErrorOperator=function(){function ReplaceErrorOperator(fn,ins){this.fn=fn;this.ins=ins;this.out=empty}ReplaceErrorOperator.prototype._start=function(out){this.out=out;this.ins._add(this)};ReplaceErrorOperator.prototype._stop=function(){this.ins._remove(this);this.out=null};ReplaceErrorOperator.prototype._n=function(t){this.out._n(t)};ReplaceErrorOperator.prototype._e=function(err){try{this.ins._remove(this);(this.ins=this.fn(err))._add(this)}catch(e){this.out._e(e)}};ReplaceErrorOperator.prototype._c=function(){this.out._c()};return ReplaceErrorOperator}();exports.ReplaceErrorOperator=ReplaceErrorOperator;var StartWithOperator=function(){function StartWithOperator(ins,value){this.ins=ins;this.value=value;this.out=emptyListener}StartWithOperator.prototype._start=function(out){this.out=out;this.out._n(this.value);this.ins._add(out)};StartWithOperator.prototype._stop=function(){this.ins._remove(this.out);this.out=null};return StartWithOperator}();exports.StartWithOperator=StartWithOperator;var TakeOperator=function(){function TakeOperator(max,ins){this.max=max;this.ins=ins;this.out=null;this.taken=0}TakeOperator.prototype._start=function(out){this.out=out;this.ins._add(this)};TakeOperator.prototype._stop=function(){this.ins._remove(this);this.out=null;this.taken=0};TakeOperator.prototype._n=function(t){var out=this.out;if(!out)return;if(this.taken++<this.max-1){out._n(t)}else{out._n(t);out._c();this._stop()}};TakeOperator.prototype._e=function(err){var out=this.out;if(!out)return;out._e(err)};TakeOperator.prototype._c=function(){var out=this.out;if(!out)return;out._c()};return TakeOperator}();exports.TakeOperator=TakeOperator;var Stream=function(){function Stream(producer){this._stopID=empty;this.combine=function combine(project){var streams=[];for(var _i=1;_i<arguments.length;_i++){streams[_i-1]=arguments[_i]}streams.unshift(this);return Stream.combine.apply(Stream,[project].concat(streams))};this._prod=producer;this._ils=[]}Stream.prototype._n=function(t){var a=this._ils;var L=a.length;if(L==1)a[0]._n(t);else{var b=copy(a);for(var i=0;i<L;i++)b[i]._n(t)}};Stream.prototype._e=function(err){var a=this._ils;var L=a.length;if(L==1)a[0]._e(err);else{var b=copy(a);for(var i=0;i<L;i++)b[i]._e(err)}this._x()};Stream.prototype._c=function(){var a=this._ils;var L=a.length;if(L==1)a[0]._c();else{var b=copy(a);for(var i=0;i<L;i++)b[i]._c()}this._x()};Stream.prototype._x=function(){if(this._ils.length===0)return;if(this._prod)this._prod._stop();this._ils=[]};Stream.prototype.addListener=function(listener){if(typeof listener.next!=="function"||typeof listener.error!=="function"||typeof listener.complete!=="function"){throw new Error("stream.addListener() requires all three next, error, "+"and complete functions.")}listener._n=listener.next;listener._e=listener.error;listener._c=listener.complete;this._add(listener)};Stream.prototype.removeListener=function(listener){this._remove(listener)};Stream.prototype._add=function(il){var a=this._ils;a.push(il);if(a.length===1){if(this._stopID!==empty){clearTimeout(this._stopID);this._stopID=empty}var p=this._prod;if(p)p._start(this)}};Stream.prototype._remove=function(il){var a=this._ils;var i=a.indexOf(il);if(i>-1){a.splice(i,1);var p_1=this._prod;if(p_1&&a.length<=0){this._stopID=setTimeout(function(){return p_1._stop()})}}};Stream.create=function(producer){if(producer){internalizeProducer(producer)}return new Stream(producer)};Stream.createWithMemory=function(producer){if(producer){internalizeProducer(producer)}return new MemoryStream(producer)};Stream.never=function(){return new Stream({_start:noop,_stop:noop})};Stream.empty=function(){return new Stream({_start:function(il){il._c()},_stop:noop})};Stream.throw=function(error){return new Stream({_start:function(il){il._e(error)},_stop:noop})};Stream.of=function(){var items=[];for(var _i=0;_i<arguments.length;_i++){items[_i-0]=arguments[_i]}return Stream.fromArray(items)};Stream.fromArray=function(array){return new Stream(new FromArrayProducer(array))};Stream.fromPromise=function(promise){return new Stream(new FromPromiseProducer(promise))};Stream.periodic=function(period){return new Stream(new PeriodicProducer(period))};Stream.merge=function(){var streams=[];for(var _i=0;_i<arguments.length;_i++){streams[_i-0]=arguments[_i]}return new Stream(new MergeProducer(streams))};Stream.prototype.map=function(project){var p=this._prod;if(p instanceof FilterOperator){return new Stream(new FilterMapOperator(p.passes,project,p.ins))}if(p instanceof FilterMapOperator){return new Stream(new FilterMapOperator(p.passes,compose2(project,p.project),p.ins))}if(p instanceof MapOperator){return new Stream(new MapOperator(compose2(project,p.project),p.ins))}return new Stream(new MapOperator(project,this))};Stream.prototype.mapTo=function(projectedValue){return new Stream(new MapToOperator(projectedValue,this))};Stream.prototype.filter=function(passes){var p=this._prod;if(p instanceof FilterOperator){return new Stream(new FilterOperator(and(passes,p.passes),p.ins))}return new Stream(new FilterOperator(passes,this))};Stream.prototype.take=function(amount){return new Stream(new TakeOperator(amount,this))};Stream.prototype.drop=function(amount){return new Stream(new DropOperator(amount,this))};Stream.prototype.last=function(){return new Stream(new LastOperator(this))};Stream.prototype.startWith=function(initial){return new Stream(new StartWithOperator(this,initial))};Stream.prototype.endWhen=function(other){return new Stream(new EndWhenOperator(other,this))};Stream.prototype.fold=function(accumulate,seed){return new Stream(new FoldOperator(accumulate,seed,this))};Stream.prototype.replaceError=function(replace){return new Stream(new ReplaceErrorOperator(replace,this))};Stream.prototype.flatten=function(){var p=this._prod;return new Stream(p instanceof MapOperator||p instanceof FilterMapOperator?new MapFlattenOperator(p):new FlattenOperator(this))};Stream.prototype.flattenConcurrently=function(){var p=this._prod;return new Stream(p instanceof MapOperator||p instanceof FilterMapOperator?new MapFlattenConcOperator(p):new FlattenConcOperator(this))};Stream.prototype.merge=function(other){return Stream.merge(this,other)};Stream.prototype.compose=function(operator){return operator(this)};Stream.prototype.remember=function(){return new MemoryStream(this._prod)};Stream.prototype.imitate=function(other){other._add(this)};Stream.prototype.debug=function(spy){if(spy===void 0){spy=null}return new Stream(new DebugOperator(spy,this))};Stream.prototype.shamefullySendNext=function(value){this._n(value)};Stream.prototype.shamefullySendError=function(error){this._e(error)};Stream.prototype.shamefullySendComplete=function(){this._c()};Stream.combine=function combine(project){var streams=[];for(var _i=1;_i<arguments.length;_i++){streams[_i-1]=arguments[_i]}return new Stream(new CombineProducer(project,streams))};return Stream}();exports.Stream=Stream;var MemoryStream=function(_super){__extends(MemoryStream,_super);function MemoryStream(producer){_super.call(this,producer);this._has=false}MemoryStream.prototype._n=function(x){this._val=x;this._has=true;_super.prototype._n.call(this,x)};MemoryStream.prototype._add=function(listener){if(this._has){listener._n(this._val)}_super.prototype._add.call(this,listener)};return MemoryStream}(Stream);exports.MemoryStream=MemoryStream;Object.defineProperty(exports,"__esModule",{value:true});exports.default=Stream},{}],3:[function(require,module,exports){"use strict";var core_1=require("./core");exports.Stream=core_1.Stream;exports.MemoryStream=core_1.MemoryStream;Object.defineProperty(exports,"__esModule",{value:true});exports.default=core_1.Stream},{"./core":2}]},{},[1])(1)}); |
{ | ||
"name": "@cycle/xstream-adapter", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Cycle.js xstream Stream Adapter", | ||
@@ -53,6 +53,6 @@ "main": "lib/index.js", | ||
"validate-commit-msg": "^2.4.0", | ||
"xstream": "1.0.x" | ||
"xstream": "2.x.x" | ||
}, | ||
"peerDependencies": { | ||
"xstream": "1.x.x" | ||
"xstream": "2.x.x" | ||
}, | ||
@@ -59,0 +59,0 @@ "config": { |
@@ -31,3 +31,3 @@ import {describe, it} from 'mocha'; | ||
next(x) { assert.strictEqual(x, expected.shift()); }, | ||
error: done.fail, | ||
error: done, | ||
complete() { | ||
@@ -50,3 +50,3 @@ assert.strictEqual(expected.length, 0) | ||
next: (x) => assert.strictEqual(x, observer1Expected.shift()), | ||
error: done.fail, | ||
error: done, | ||
complete: () => assert.strictEqual(observer1Expected.length, 0), | ||
@@ -60,3 +60,3 @@ }); | ||
next: (x) => assert.strictEqual(x, observer2Expected.shift()), | ||
error: done.fail, | ||
error: done, | ||
complete: () => assert.strictEqual(observer2Expected.length, 0), | ||
@@ -63,0 +63,0 @@ }); |
// Generated by typings | ||
// Source: node_modules/xstream/lib/core.d.ts | ||
declare module '~xstream/lib/core' { | ||
// Source: node_modules/xstream/core.d.ts | ||
declare module '~xstream/core' { | ||
export interface InternalListener<T> { | ||
@@ -51,2 +51,81 @@ _n: (v: T) => void; | ||
} | ||
export class FromArrayProducer<T> implements InternalProducer<T> { | ||
a: Array<T>; | ||
constructor(a: Array<T>); | ||
_start(out: InternalListener<T>): void; | ||
_stop(): void; | ||
} | ||
export class FromPromiseProducer<T> implements InternalProducer<T> { | ||
p: Promise<T>; | ||
on: boolean; | ||
constructor(p: Promise<T>); | ||
_start(out: InternalListener<T>): void; | ||
_stop(): void; | ||
} | ||
export class MergeProducer<T> implements InternalProducer<T>, InternalListener<T> { | ||
streams: Array<Stream<T>>; | ||
private out; | ||
private ac; | ||
constructor(streams: Array<Stream<T>>); | ||
_start(out: InternalListener<T>): void; | ||
_stop(): void; | ||
_n(t: T): void; | ||
_e(err: any): void; | ||
_c(): void; | ||
} | ||
export class PeriodicProducer implements InternalProducer<number> { | ||
period: number; | ||
private intervalID; | ||
private i; | ||
constructor(period: number); | ||
_start(stream: InternalListener<number>): void; | ||
_stop(): void; | ||
} | ||
export class DebugOperator<T> implements Operator<T, T> { | ||
spy: (t: T) => any; | ||
ins: Stream<T>; | ||
private out; | ||
constructor(spy: (t: T) => any, ins: Stream<T>); | ||
_start(out: Stream<T>): void; | ||
_stop(): void; | ||
_n(t: T): void; | ||
_e(err: any): void; | ||
_c(): void; | ||
} | ||
export class DropOperator<T> implements Operator<T, T> { | ||
max: number; | ||
ins: Stream<T>; | ||
private out; | ||
private dropped; | ||
constructor(max: number, ins: Stream<T>); | ||
_start(out: Stream<T>): void; | ||
_stop(): void; | ||
_n(t: T): void; | ||
_e(err: any): void; | ||
_c(): void; | ||
} | ||
export class EndWhenOperator<T> implements Operator<T, T> { | ||
o: Stream<any>; | ||
ins: Stream<T>; | ||
private out; | ||
private oli; | ||
constructor(o: Stream<any>, ins: Stream<T>); | ||
_start(out: Stream<T>): void; | ||
_stop(): void; | ||
end(): void; | ||
_n(t: T): void; | ||
_e(err: any): void; | ||
_c(): void; | ||
} | ||
export class FilterOperator<T> implements Operator<T, T> { | ||
passes: (t: T) => boolean; | ||
ins: Stream<T>; | ||
private out; | ||
constructor(passes: (t: T) => boolean, ins: Stream<T>); | ||
_start(out: Stream<T>): void; | ||
_stop(): void; | ||
_n(t: T): void; | ||
_e(err: any): void; | ||
_c(): void; | ||
} | ||
export class FlattenConcOperator<T> implements Operator<Stream<T>, T> { | ||
@@ -79,2 +158,112 @@ ins: Stream<Stream<T>>; | ||
} | ||
export class FoldOperator<T, R> implements Operator<T, R> { | ||
f: (acc: R, t: T) => R; | ||
seed: R; | ||
ins: Stream<T>; | ||
private out; | ||
private acc; | ||
constructor(f: (acc: R, t: T) => R, seed: R, ins: Stream<T>); | ||
_start(out: Stream<R>): void; | ||
_stop(): void; | ||
_n(t: T): void; | ||
_e(err: any): void; | ||
_c(): void; | ||
} | ||
export class LastOperator<T> implements Operator<T, T> { | ||
ins: Stream<T>; | ||
private out; | ||
private has; | ||
private val; | ||
constructor(ins: Stream<T>); | ||
_start(out: Stream<T>): void; | ||
_stop(): void; | ||
_n(t: T): void; | ||
_e(err: any): void; | ||
_c(): void; | ||
} | ||
export class MapFlattenConcOperator<T> implements InternalProducer<T>, InternalListener<T> { | ||
mapOp: MapOperator<T, Stream<T>>; | ||
private active; | ||
private out; | ||
constructor(mapOp: MapOperator<T, Stream<T>>); | ||
_start(out: Stream<T>): void; | ||
_stop(): void; | ||
less(): void; | ||
_n(v: T): void; | ||
_e(err: any): void; | ||
_c(): void; | ||
} | ||
export class MapFlattenOperator<T> implements InternalProducer<T>, InternalListener<T> { | ||
mapOp: MapOperator<T, Stream<T>>; | ||
curr: Stream<T>; | ||
private inner; | ||
private open; | ||
private out; | ||
constructor(mapOp: MapOperator<T, Stream<T>>); | ||
_start(out: Stream<T>): void; | ||
_stop(): void; | ||
cut(): void; | ||
less(): void; | ||
_n(v: T): void; | ||
_e(err: any): void; | ||
_c(): void; | ||
} | ||
export class MapOperator<T, R> implements Operator<T, R> { | ||
project: (t: T) => R; | ||
ins: Stream<T>; | ||
protected out: Stream<R>; | ||
constructor(project: (t: T) => R, ins: Stream<T>); | ||
_start(out: Stream<R>): void; | ||
_stop(): void; | ||
_n(t: T): void; | ||
_e(err: any): void; | ||
_c(): void; | ||
} | ||
export class FilterMapOperator<T, R> extends MapOperator<T, R> { | ||
passes: (t: T) => boolean; | ||
constructor(passes: (t: T) => boolean, project: (t: T) => R, ins: Stream<T>); | ||
_n(v: T): void; | ||
} | ||
export class MapToOperator<T, R> implements Operator<T, R> { | ||
val: R; | ||
ins: Stream<T>; | ||
private out; | ||
constructor(val: R, ins: Stream<T>); | ||
_start(out: Stream<R>): void; | ||
_stop(): void; | ||
_n(t: T): void; | ||
_e(err: any): void; | ||
_c(): void; | ||
} | ||
export class ReplaceErrorOperator<T> implements Operator<T, T> { | ||
fn: (err: any) => Stream<T>; | ||
ins: Stream<T>; | ||
private out; | ||
constructor(fn: (err: any) => Stream<T>, ins: Stream<T>); | ||
_start(out: Stream<T>): void; | ||
_stop(): void; | ||
_n(t: T): void; | ||
_e(err: any): void; | ||
_c(): void; | ||
} | ||
export class StartWithOperator<T> implements InternalProducer<T> { | ||
ins: Stream<T>; | ||
value: T; | ||
private out; | ||
constructor(ins: Stream<T>, value: T); | ||
_start(out: InternalListener<T>): void; | ||
_stop(): void; | ||
} | ||
export class TakeOperator<T> implements Operator<T, T> { | ||
max: number; | ||
ins: Stream<T>; | ||
private out; | ||
private taken; | ||
constructor(max: number, ins: Stream<T>); | ||
_start(out: Stream<T>): void; | ||
_stop(): void; | ||
_n(t: T): void; | ||
_e(err: any): void; | ||
_c(): void; | ||
} | ||
export class Stream<T> implements InternalListener<T> { | ||
@@ -683,13 +872,13 @@ private _ils; | ||
} | ||
declare module 'xstream/lib/core' { | ||
export * from '~xstream/lib/core'; | ||
export { default } from '~xstream/lib/core'; | ||
declare module 'xstream/core' { | ||
export * from '~xstream/core'; | ||
export { default } from '~xstream/core'; | ||
} | ||
// Generated by typings | ||
// Source: node_modules/xstream/lib/index.d.ts | ||
// Source: node_modules/xstream/index.d.ts | ||
declare module 'xstream' { | ||
import { Stream, MemoryStream, Listener, Producer, Operator } from '~xstream/lib/core'; | ||
import { Stream, MemoryStream, Listener, Producer, Operator } from '~xstream/core'; | ||
export { Stream, MemoryStream, Listener, Producer, Operator }; | ||
export default Stream; | ||
} |
// Generated by typings | ||
// Source: node_modules/xstream/lib/core.d.ts | ||
declare module '~xstream/lib/core' { | ||
// Source: node_modules/xstream/core.d.ts | ||
declare module '~xstream/core' { | ||
export interface InternalListener<T> { | ||
@@ -51,2 +51,81 @@ _n: (v: T) => void; | ||
} | ||
export class FromArrayProducer<T> implements InternalProducer<T> { | ||
a: Array<T>; | ||
constructor(a: Array<T>); | ||
_start(out: InternalListener<T>): void; | ||
_stop(): void; | ||
} | ||
export class FromPromiseProducer<T> implements InternalProducer<T> { | ||
p: Promise<T>; | ||
on: boolean; | ||
constructor(p: Promise<T>); | ||
_start(out: InternalListener<T>): void; | ||
_stop(): void; | ||
} | ||
export class MergeProducer<T> implements InternalProducer<T>, InternalListener<T> { | ||
streams: Array<Stream<T>>; | ||
private out; | ||
private ac; | ||
constructor(streams: Array<Stream<T>>); | ||
_start(out: InternalListener<T>): void; | ||
_stop(): void; | ||
_n(t: T): void; | ||
_e(err: any): void; | ||
_c(): void; | ||
} | ||
export class PeriodicProducer implements InternalProducer<number> { | ||
period: number; | ||
private intervalID; | ||
private i; | ||
constructor(period: number); | ||
_start(stream: InternalListener<number>): void; | ||
_stop(): void; | ||
} | ||
export class DebugOperator<T> implements Operator<T, T> { | ||
spy: (t: T) => any; | ||
ins: Stream<T>; | ||
private out; | ||
constructor(spy: (t: T) => any, ins: Stream<T>); | ||
_start(out: Stream<T>): void; | ||
_stop(): void; | ||
_n(t: T): void; | ||
_e(err: any): void; | ||
_c(): void; | ||
} | ||
export class DropOperator<T> implements Operator<T, T> { | ||
max: number; | ||
ins: Stream<T>; | ||
private out; | ||
private dropped; | ||
constructor(max: number, ins: Stream<T>); | ||
_start(out: Stream<T>): void; | ||
_stop(): void; | ||
_n(t: T): void; | ||
_e(err: any): void; | ||
_c(): void; | ||
} | ||
export class EndWhenOperator<T> implements Operator<T, T> { | ||
o: Stream<any>; | ||
ins: Stream<T>; | ||
private out; | ||
private oli; | ||
constructor(o: Stream<any>, ins: Stream<T>); | ||
_start(out: Stream<T>): void; | ||
_stop(): void; | ||
end(): void; | ||
_n(t: T): void; | ||
_e(err: any): void; | ||
_c(): void; | ||
} | ||
export class FilterOperator<T> implements Operator<T, T> { | ||
passes: (t: T) => boolean; | ||
ins: Stream<T>; | ||
private out; | ||
constructor(passes: (t: T) => boolean, ins: Stream<T>); | ||
_start(out: Stream<T>): void; | ||
_stop(): void; | ||
_n(t: T): void; | ||
_e(err: any): void; | ||
_c(): void; | ||
} | ||
export class FlattenConcOperator<T> implements Operator<Stream<T>, T> { | ||
@@ -79,2 +158,112 @@ ins: Stream<Stream<T>>; | ||
} | ||
export class FoldOperator<T, R> implements Operator<T, R> { | ||
f: (acc: R, t: T) => R; | ||
seed: R; | ||
ins: Stream<T>; | ||
private out; | ||
private acc; | ||
constructor(f: (acc: R, t: T) => R, seed: R, ins: Stream<T>); | ||
_start(out: Stream<R>): void; | ||
_stop(): void; | ||
_n(t: T): void; | ||
_e(err: any): void; | ||
_c(): void; | ||
} | ||
export class LastOperator<T> implements Operator<T, T> { | ||
ins: Stream<T>; | ||
private out; | ||
private has; | ||
private val; | ||
constructor(ins: Stream<T>); | ||
_start(out: Stream<T>): void; | ||
_stop(): void; | ||
_n(t: T): void; | ||
_e(err: any): void; | ||
_c(): void; | ||
} | ||
export class MapFlattenConcOperator<T> implements InternalProducer<T>, InternalListener<T> { | ||
mapOp: MapOperator<T, Stream<T>>; | ||
private active; | ||
private out; | ||
constructor(mapOp: MapOperator<T, Stream<T>>); | ||
_start(out: Stream<T>): void; | ||
_stop(): void; | ||
less(): void; | ||
_n(v: T): void; | ||
_e(err: any): void; | ||
_c(): void; | ||
} | ||
export class MapFlattenOperator<T> implements InternalProducer<T>, InternalListener<T> { | ||
mapOp: MapOperator<T, Stream<T>>; | ||
curr: Stream<T>; | ||
private inner; | ||
private open; | ||
private out; | ||
constructor(mapOp: MapOperator<T, Stream<T>>); | ||
_start(out: Stream<T>): void; | ||
_stop(): void; | ||
cut(): void; | ||
less(): void; | ||
_n(v: T): void; | ||
_e(err: any): void; | ||
_c(): void; | ||
} | ||
export class MapOperator<T, R> implements Operator<T, R> { | ||
project: (t: T) => R; | ||
ins: Stream<T>; | ||
protected out: Stream<R>; | ||
constructor(project: (t: T) => R, ins: Stream<T>); | ||
_start(out: Stream<R>): void; | ||
_stop(): void; | ||
_n(t: T): void; | ||
_e(err: any): void; | ||
_c(): void; | ||
} | ||
export class FilterMapOperator<T, R> extends MapOperator<T, R> { | ||
passes: (t: T) => boolean; | ||
constructor(passes: (t: T) => boolean, project: (t: T) => R, ins: Stream<T>); | ||
_n(v: T): void; | ||
} | ||
export class MapToOperator<T, R> implements Operator<T, R> { | ||
val: R; | ||
ins: Stream<T>; | ||
private out; | ||
constructor(val: R, ins: Stream<T>); | ||
_start(out: Stream<R>): void; | ||
_stop(): void; | ||
_n(t: T): void; | ||
_e(err: any): void; | ||
_c(): void; | ||
} | ||
export class ReplaceErrorOperator<T> implements Operator<T, T> { | ||
fn: (err: any) => Stream<T>; | ||
ins: Stream<T>; | ||
private out; | ||
constructor(fn: (err: any) => Stream<T>, ins: Stream<T>); | ||
_start(out: Stream<T>): void; | ||
_stop(): void; | ||
_n(t: T): void; | ||
_e(err: any): void; | ||
_c(): void; | ||
} | ||
export class StartWithOperator<T> implements InternalProducer<T> { | ||
ins: Stream<T>; | ||
value: T; | ||
private out; | ||
constructor(ins: Stream<T>, value: T); | ||
_start(out: InternalListener<T>): void; | ||
_stop(): void; | ||
} | ||
export class TakeOperator<T> implements Operator<T, T> { | ||
max: number; | ||
ins: Stream<T>; | ||
private out; | ||
private taken; | ||
constructor(max: number, ins: Stream<T>); | ||
_start(out: Stream<T>): void; | ||
_stop(): void; | ||
_n(t: T): void; | ||
_e(err: any): void; | ||
_c(): void; | ||
} | ||
export class Stream<T> implements InternalListener<T> { | ||
@@ -683,13 +872,13 @@ private _ils; | ||
} | ||
declare module 'xstream/lib/core' { | ||
export * from '~xstream/lib/core'; | ||
export { default } from '~xstream/lib/core'; | ||
declare module 'xstream/core' { | ||
export * from '~xstream/core'; | ||
export { default } from '~xstream/core'; | ||
} | ||
// Generated by typings | ||
// Source: node_modules/xstream/lib/index.d.ts | ||
// Source: node_modules/xstream/index.d.ts | ||
declare module 'xstream' { | ||
import { Stream, MemoryStream, Listener, Producer, Operator } from '~xstream/lib/core'; | ||
import { Stream, MemoryStream, Listener, Producer, Operator } from '~xstream/core'; | ||
export { Stream, MemoryStream, Listener, Producer, Operator }; | ||
export default Stream; | ||
} |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
404083
9525
1