@cycle/xstream-adapter
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -79,10 +79,2 @@ (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 = { | ||
@@ -120,7 +112,2 @@ _n: noop, | ||
} | ||
function and(f1, f2) { | ||
return function andFn(t) { | ||
return f1(t) && f2(t); | ||
}; | ||
} | ||
var CombineListener = (function () { | ||
@@ -215,3 +202,2 @@ function CombineListener(i, prod) { | ||
}()); | ||
exports.FromArrayProducer = FromArrayProducer; | ||
var FromPromiseProducer = (function () { | ||
@@ -241,3 +227,2 @@ function FromPromiseProducer(p) { | ||
}()); | ||
exports.FromPromiseProducer = FromPromiseProducer; | ||
var MergeProducer = (function () { | ||
@@ -277,3 +262,2 @@ function MergeProducer(streams) { | ||
}()); | ||
exports.MergeProducer = MergeProducer; | ||
var PeriodicProducer = (function () { | ||
@@ -298,3 +282,2 @@ function PeriodicProducer(period) { | ||
}()); | ||
exports.PeriodicProducer = PeriodicProducer; | ||
var DebugOperator = (function () { | ||
@@ -337,3 +320,2 @@ function DebugOperator(spy, ins) { | ||
}()); | ||
exports.DebugOperator = DebugOperator; | ||
var DropOperator = (function () { | ||
@@ -367,3 +349,2 @@ function DropOperator(max, ins) { | ||
}()); | ||
exports.DropOperator = DropOperator; | ||
var OtherListener = (function () { | ||
@@ -418,3 +399,2 @@ function OtherListener(out, op) { | ||
}()); | ||
exports.EndWhenOperator = EndWhenOperator; | ||
var FilterOperator = (function () { | ||
@@ -451,3 +431,2 @@ function FilterOperator(passes, ins) { | ||
}()); | ||
exports.FilterOperator = FilterOperator; | ||
var FCInner = (function () { | ||
@@ -597,3 +576,2 @@ function FCInner(out, op) { | ||
}()); | ||
exports.FoldOperator = FoldOperator; | ||
var LastOperator = (function () { | ||
@@ -635,3 +613,2 @@ function LastOperator(ins) { | ||
}()); | ||
exports.LastOperator = LastOperator; | ||
var MFCInner = (function () { | ||
@@ -690,3 +667,2 @@ function MFCInner(out, op) { | ||
}()); | ||
exports.MapFlattenConcOperator = MapFlattenConcOperator; | ||
var MFInner = (function () { | ||
@@ -757,3 +733,2 @@ function MFInner(out, op) { | ||
}()); | ||
exports.MapFlattenOperator = MapFlattenOperator; | ||
var MapOperator = (function () { | ||
@@ -789,3 +764,2 @@ function MapOperator(project, ins) { | ||
}()); | ||
exports.MapOperator = MapOperator; | ||
var FilterMapOperator = (function (_super) { | ||
@@ -805,3 +779,2 @@ __extends(FilterMapOperator, _super); | ||
}(MapOperator)); | ||
exports.FilterMapOperator = FilterMapOperator; | ||
var MapToOperator = (function () { | ||
@@ -832,3 +805,2 @@ function MapToOperator(val, ins) { | ||
}()); | ||
exports.MapToOperator = MapToOperator; | ||
var ReplaceErrorOperator = (function () { | ||
@@ -865,3 +837,2 @@ function ReplaceErrorOperator(fn, ins) { | ||
}()); | ||
exports.ReplaceErrorOperator = ReplaceErrorOperator; | ||
var StartWithOperator = (function () { | ||
@@ -884,3 +855,2 @@ function StartWithOperator(ins, value) { | ||
}()); | ||
exports.StartWithOperator = StartWithOperator; | ||
var TakeOperator = (function () { | ||
@@ -904,4 +874,2 @@ function TakeOperator(max, ins) { | ||
var out = this.out; | ||
if (!out) | ||
return; | ||
if (this.taken++ < this.max - 1) { | ||
@@ -917,16 +885,9 @@ out._n(t); | ||
TakeOperator.prototype._e = function (err) { | ||
var out = this.out; | ||
if (!out) | ||
return; | ||
out._e(err); | ||
this.out._e(err); | ||
}; | ||
TakeOperator.prototype._c = function () { | ||
var out = this.out; | ||
if (!out) | ||
return; | ||
out._c(); | ||
this.out._c(); | ||
}; | ||
return TakeOperator; | ||
}()); | ||
exports.TakeOperator = TakeOperator; | ||
var Stream = (function () { | ||
@@ -977,9 +938,10 @@ function Stream(producer) { | ||
var a = this._ils; | ||
var L = a.length; | ||
if (L == 1) | ||
var len = a.length; | ||
if (len === 1) { | ||
a[0]._n(t); | ||
} | ||
else { | ||
var b = copy(a); | ||
for (var i = 0; i < L; i++) | ||
b[i]._n(t); | ||
for (var i = 0; i < len; i++) { | ||
a[i]._n(t); | ||
} | ||
} | ||
@@ -989,9 +951,10 @@ }; | ||
var a = this._ils; | ||
var L = a.length; | ||
if (L == 1) | ||
var len = a.length; | ||
if (len === 1) { | ||
a[0]._e(err); | ||
} | ||
else { | ||
var b = copy(a); | ||
for (var i = 0; i < L; i++) | ||
b[i]._e(err); | ||
for (var i = 0; i < len; i++) { | ||
a[i]._e(err); | ||
} | ||
} | ||
@@ -1002,9 +965,10 @@ this._x(); | ||
var a = this._ils; | ||
var L = a.length; | ||
if (L == 1) | ||
var len = a.length; | ||
if (len === 1) { | ||
a[0]._c(); | ||
} | ||
else { | ||
var b = copy(a); | ||
for (var i = 0; i < L; i++) | ||
b[i]._c(); | ||
for (var i = 0; i < len; i++) { | ||
a[i]._c(); | ||
} | ||
} | ||
@@ -1026,8 +990,2 @@ 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; | ||
@@ -1336,4 +1294,10 @@ 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(and(passes, p.passes), p.ins)); | ||
return new Stream(new FilterOperator(compose2(passes, p.passes), p.ins)); | ||
} | ||
@@ -1340,0 +1304,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(){}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)}); | ||
(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)}); |
@@ -41,4 +41,4 @@ "use strict"; | ||
}); | ||
Object.keys(sinkProxies).forEach(function (k) { | ||
sinkProxies[k].observer.complete(); | ||
Object.keys(sinks).forEach(function (k) { | ||
sinks[k].removeListener(sinkProxies[k].stream); | ||
}); | ||
@@ -45,0 +45,0 @@ }, |
{ | ||
"name": "@cycle/xstream-adapter", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "Cycle.js xstream Stream Adapter", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -48,4 +48,4 @@ import { | ||
}); | ||
Object.keys(sinkProxies).forEach(k => { | ||
sinkProxies[k].observer.complete(); | ||
Object.keys(sinks).forEach(k => { | ||
sinks[k].removeListener(sinkProxies[k].stream); | ||
}); | ||
@@ -52,0 +52,0 @@ }, |
import {describe, it} from 'mocha'; | ||
import assert from 'assert'; | ||
import XStreamAdapter from '../lib'; | ||
import * as xs from 'xstream'; | ||
import xs from 'xstream'; | ||
import {MemoryStream} from 'xstream/core'; | ||
@@ -41,3 +42,3 @@ describe('XStreamAdapter', () => { | ||
const holdSubject = XStreamAdapter.makeHoldSubject(); | ||
assert.strictEqual(holdSubject.stream instanceof xs.MemoryStream, true); | ||
assert.strictEqual(holdSubject.stream instanceof MemoryStream, true); | ||
assert.strictEqual(XStreamAdapter.isValidStream(holdSubject.stream), true); | ||
@@ -69,2 +70,24 @@ | ||
}); | ||
it('should not complete a sink stream when dispose() is called', (done) => { | ||
const sinkProxy = XStreamAdapter.makeHoldSubject(); | ||
const sink = xs.periodic(50); | ||
const expectedProxy = [0, 1]; | ||
sinkProxy.stream.addListener({ | ||
next: (x) => { | ||
assert.strictEqual(x, expectedProxy.shift()); | ||
if (expectedProxy.length === 0) { | ||
XStreamAdapter.dispose({A: sink}, {A: sinkProxy}, {}); | ||
setTimeout(() => { | ||
done(); | ||
}, 75); | ||
} | ||
}, | ||
error: err => done(err), | ||
complete: () => done('complete should not be called'), | ||
}); | ||
sink._add(sinkProxy.stream); | ||
}); | ||
}); |
@@ -19,2 +19,3 @@ // Generated by typings | ||
_c: () => void; | ||
type: string; | ||
} | ||
@@ -39,6 +40,6 @@ export interface Producer<T> { | ||
export interface CombineFactorySignature { | ||
<T1, T2, R>(project: (t1: T1, t2: T2) => R, stream2: Stream<T2>): Stream<R>; | ||
<T1, T2, T3, R>(project: (t1: T1, t2: T2, t3: T3) => R, stream2: Stream<T2>, stream3: Stream<T3>): Stream<R>; | ||
<T1, T2, T3, T4, R>(project: (t1: T1, t2: T2, t3: T3, t4: T4) => R, stream2: Stream<T2>, stream3: Stream<T3>, stream4: Stream<T4>): Stream<R>; | ||
<T1, T2, T3, T4, T5, R>(project: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R, stream2: Stream<T2>, stream3: Stream<T3>, stream4: Stream<T4>, stream5: Stream<T5>): Stream<R>; | ||
<T1, T2, R>(project: (t1: T1, t2: T2) => R, stream1: Stream<T1>, stream2: Stream<T2>): Stream<R>; | ||
<T1, T2, T3, R>(project: (t1: T1, t2: T2, t3: T3) => R, stream1: Stream<T1>, stream2: Stream<T2>, stream3: Stream<T3>): Stream<R>; | ||
<T1, T2, T3, T4, R>(project: (t1: T1, t2: T2, t3: T3, t4: T4) => R, stream1: Stream<T1>, stream2: Stream<T2>, stream3: Stream<T3>, stream4: Stream<T4>): Stream<R>; | ||
<T1, T2, T3, T4, T5, R>(project: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R, stream1: Stream<T1>, stream2: Stream<T2>, stream3: Stream<T3>, stream4: Stream<T4>, stream5: Stream<T5>): Stream<R>; | ||
<R>(project: (...args: Array<any>) => R, ...streams: Array<Stream<any>>): Stream<R>; | ||
@@ -53,4 +54,28 @@ } | ||
} | ||
export class CombineListener<T> implements InternalListener<T> { | ||
private i; | ||
private p; | ||
constructor(i: number, p: CombineProducer<T>); | ||
_n(t: T): void; | ||
_e(err: any): void; | ||
_c(): void; | ||
} | ||
export class CombineProducer<R> implements InternalProducer<R> { | ||
project: CombineProjectFunction; | ||
streams: Array<Stream<any>>; | ||
type: string; | ||
out: InternalListener<R>; | ||
ils: Array<CombineListener<any>>; | ||
ac: number; | ||
left: number; | ||
vals: Array<any>; | ||
constructor(project: CombineProjectFunction, streams: Array<Stream<any>>); | ||
up(t: any, i: number): boolean; | ||
_start(out: InternalListener<R>): void; | ||
_stop(): void; | ||
zero(out: InternalListener<R>): void; | ||
} | ||
export class FromArrayProducer<T> implements InternalProducer<T> { | ||
a: Array<T>; | ||
type: string; | ||
constructor(a: Array<T>); | ||
@@ -62,2 +87,3 @@ _start(out: InternalListener<T>): void; | ||
p: Promise<T>; | ||
type: string; | ||
on: boolean; | ||
@@ -70,2 +96,3 @@ constructor(p: Promise<T>); | ||
streams: Array<Stream<T>>; | ||
type: string; | ||
private out; | ||
@@ -82,2 +109,3 @@ private ac; | ||
period: number; | ||
type: string; | ||
private intervalID; | ||
@@ -92,2 +120,3 @@ private i; | ||
ins: Stream<T>; | ||
type: string; | ||
private out; | ||
@@ -104,2 +133,3 @@ constructor(spy: (t: T) => any, ins: Stream<T>); | ||
ins: Stream<T>; | ||
type: string; | ||
private out; | ||
@@ -117,4 +147,5 @@ private dropped; | ||
ins: Stream<T>; | ||
type: string; | ||
private out; | ||
private oli; | ||
private oil; | ||
constructor(o: Stream<any>, ins: Stream<T>); | ||
@@ -131,2 +162,3 @@ _start(out: Stream<T>): void; | ||
ins: Stream<T>; | ||
type: string; | ||
private out; | ||
@@ -142,2 +174,3 @@ constructor(passes: (t: T) => boolean, ins: Stream<T>); | ||
ins: Stream<Stream<T>>; | ||
type: string; | ||
private active; | ||
@@ -155,4 +188,5 @@ private out; | ||
ins: Stream<Stream<T>>; | ||
curr: Stream<T>; | ||
private inner; | ||
type: string; | ||
inner: Stream<T>; | ||
private il; | ||
private open; | ||
@@ -163,3 +197,2 @@ private out; | ||
_stop(): void; | ||
cut(): void; | ||
less(): void; | ||
@@ -174,2 +207,3 @@ _n(s: Stream<T>): void; | ||
ins: Stream<T>; | ||
type: string; | ||
private out; | ||
@@ -186,2 +220,3 @@ private acc; | ||
ins: Stream<T>; | ||
type: string; | ||
private out; | ||
@@ -199,2 +234,3 @@ private has; | ||
mapOp: MapOperator<T, Stream<T>>; | ||
type: string; | ||
private active; | ||
@@ -212,4 +248,5 @@ private out; | ||
mapOp: MapOperator<T, Stream<T>>; | ||
curr: Stream<T>; | ||
private inner; | ||
type: string; | ||
inner: Stream<T>; | ||
private il; | ||
private open; | ||
@@ -220,3 +257,2 @@ private out; | ||
_stop(): void; | ||
cut(): void; | ||
less(): void; | ||
@@ -230,2 +266,3 @@ _n(v: T): void; | ||
ins: Stream<T>; | ||
type: string; | ||
protected out: Stream<R>; | ||
@@ -241,2 +278,3 @@ constructor(project: (t: T) => R, ins: Stream<T>); | ||
passes: (t: T) => boolean; | ||
type: string; | ||
constructor(passes: (t: T) => boolean, project: (t: T) => R, ins: Stream<T>); | ||
@@ -248,2 +286,3 @@ _n(v: T): void; | ||
ins: Stream<T>; | ||
type: string; | ||
private out; | ||
@@ -260,2 +299,3 @@ constructor(val: R, ins: Stream<T>); | ||
ins: Stream<T>; | ||
type: string; | ||
private out; | ||
@@ -272,2 +312,3 @@ constructor(fn: (err: any) => Stream<T>, ins: Stream<T>); | ||
value: T; | ||
type: string; | ||
private out; | ||
@@ -281,2 +322,3 @@ constructor(ins: Stream<T>, value: T); | ||
ins: Stream<T>; | ||
type: string; | ||
private out; | ||
@@ -721,3 +763,3 @@ private taken; | ||
*/ | ||
flatten<R, T extends Stream<R>>(): T; | ||
flatten<R>(): T; | ||
/** | ||
@@ -748,3 +790,3 @@ * Flattens a "stream of streams", handling multiple concurrent nested streams | ||
*/ | ||
flattenConcurrently<R, T extends Stream<R>>(): T; | ||
flattenConcurrently<R>(): T; | ||
/** | ||
@@ -817,5 +859,5 @@ * Blends two streams together, emitting events from both. | ||
* | ||
* @return {Stream} | ||
* @return {MemoryStream} | ||
*/ | ||
remember(): Stream<T>; | ||
remember(): MemoryStream<T>; | ||
/** | ||
@@ -889,7 +931,7 @@ * Changes this current stream to imitate the `other` given stream. | ||
export class MemoryStream<T> extends Stream<T> { | ||
private _val; | ||
private _v; | ||
private _has; | ||
constructor(producer: InternalProducer<T>); | ||
_n(x: T): void; | ||
_add(listener: InternalListener<T>): void; | ||
_add(il: InternalListener<T>): void; | ||
} | ||
@@ -896,0 +938,0 @@ export default Stream; |
@@ -19,2 +19,3 @@ // Generated by typings | ||
_c: () => void; | ||
type: string; | ||
} | ||
@@ -39,6 +40,6 @@ export interface Producer<T> { | ||
export interface CombineFactorySignature { | ||
<T1, T2, R>(project: (t1: T1, t2: T2) => R, stream2: Stream<T2>): Stream<R>; | ||
<T1, T2, T3, R>(project: (t1: T1, t2: T2, t3: T3) => R, stream2: Stream<T2>, stream3: Stream<T3>): Stream<R>; | ||
<T1, T2, T3, T4, R>(project: (t1: T1, t2: T2, t3: T3, t4: T4) => R, stream2: Stream<T2>, stream3: Stream<T3>, stream4: Stream<T4>): Stream<R>; | ||
<T1, T2, T3, T4, T5, R>(project: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R, stream2: Stream<T2>, stream3: Stream<T3>, stream4: Stream<T4>, stream5: Stream<T5>): Stream<R>; | ||
<T1, T2, R>(project: (t1: T1, t2: T2) => R, stream1: Stream<T1>, stream2: Stream<T2>): Stream<R>; | ||
<T1, T2, T3, R>(project: (t1: T1, t2: T2, t3: T3) => R, stream1: Stream<T1>, stream2: Stream<T2>, stream3: Stream<T3>): Stream<R>; | ||
<T1, T2, T3, T4, R>(project: (t1: T1, t2: T2, t3: T3, t4: T4) => R, stream1: Stream<T1>, stream2: Stream<T2>, stream3: Stream<T3>, stream4: Stream<T4>): Stream<R>; | ||
<T1, T2, T3, T4, T5, R>(project: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R, stream1: Stream<T1>, stream2: Stream<T2>, stream3: Stream<T3>, stream4: Stream<T4>, stream5: Stream<T5>): Stream<R>; | ||
<R>(project: (...args: Array<any>) => R, ...streams: Array<Stream<any>>): Stream<R>; | ||
@@ -53,4 +54,28 @@ } | ||
} | ||
export class CombineListener<T> implements InternalListener<T> { | ||
private i; | ||
private p; | ||
constructor(i: number, p: CombineProducer<T>); | ||
_n(t: T): void; | ||
_e(err: any): void; | ||
_c(): void; | ||
} | ||
export class CombineProducer<R> implements InternalProducer<R> { | ||
project: CombineProjectFunction; | ||
streams: Array<Stream<any>>; | ||
type: string; | ||
out: InternalListener<R>; | ||
ils: Array<CombineListener<any>>; | ||
ac: number; | ||
left: number; | ||
vals: Array<any>; | ||
constructor(project: CombineProjectFunction, streams: Array<Stream<any>>); | ||
up(t: any, i: number): boolean; | ||
_start(out: InternalListener<R>): void; | ||
_stop(): void; | ||
zero(out: InternalListener<R>): void; | ||
} | ||
export class FromArrayProducer<T> implements InternalProducer<T> { | ||
a: Array<T>; | ||
type: string; | ||
constructor(a: Array<T>); | ||
@@ -62,2 +87,3 @@ _start(out: InternalListener<T>): void; | ||
p: Promise<T>; | ||
type: string; | ||
on: boolean; | ||
@@ -70,2 +96,3 @@ constructor(p: Promise<T>); | ||
streams: Array<Stream<T>>; | ||
type: string; | ||
private out; | ||
@@ -82,2 +109,3 @@ private ac; | ||
period: number; | ||
type: string; | ||
private intervalID; | ||
@@ -92,2 +120,3 @@ private i; | ||
ins: Stream<T>; | ||
type: string; | ||
private out; | ||
@@ -104,2 +133,3 @@ constructor(spy: (t: T) => any, ins: Stream<T>); | ||
ins: Stream<T>; | ||
type: string; | ||
private out; | ||
@@ -117,4 +147,5 @@ private dropped; | ||
ins: Stream<T>; | ||
type: string; | ||
private out; | ||
private oli; | ||
private oil; | ||
constructor(o: Stream<any>, ins: Stream<T>); | ||
@@ -131,2 +162,3 @@ _start(out: Stream<T>): void; | ||
ins: Stream<T>; | ||
type: string; | ||
private out; | ||
@@ -142,2 +174,3 @@ constructor(passes: (t: T) => boolean, ins: Stream<T>); | ||
ins: Stream<Stream<T>>; | ||
type: string; | ||
private active; | ||
@@ -155,4 +188,5 @@ private out; | ||
ins: Stream<Stream<T>>; | ||
curr: Stream<T>; | ||
private inner; | ||
type: string; | ||
inner: Stream<T>; | ||
private il; | ||
private open; | ||
@@ -163,3 +197,2 @@ private out; | ||
_stop(): void; | ||
cut(): void; | ||
less(): void; | ||
@@ -174,2 +207,3 @@ _n(s: Stream<T>): void; | ||
ins: Stream<T>; | ||
type: string; | ||
private out; | ||
@@ -186,2 +220,3 @@ private acc; | ||
ins: Stream<T>; | ||
type: string; | ||
private out; | ||
@@ -199,2 +234,3 @@ private has; | ||
mapOp: MapOperator<T, Stream<T>>; | ||
type: string; | ||
private active; | ||
@@ -212,4 +248,5 @@ private out; | ||
mapOp: MapOperator<T, Stream<T>>; | ||
curr: Stream<T>; | ||
private inner; | ||
type: string; | ||
inner: Stream<T>; | ||
private il; | ||
private open; | ||
@@ -220,3 +257,2 @@ private out; | ||
_stop(): void; | ||
cut(): void; | ||
less(): void; | ||
@@ -230,2 +266,3 @@ _n(v: T): void; | ||
ins: Stream<T>; | ||
type: string; | ||
protected out: Stream<R>; | ||
@@ -241,2 +278,3 @@ constructor(project: (t: T) => R, ins: Stream<T>); | ||
passes: (t: T) => boolean; | ||
type: string; | ||
constructor(passes: (t: T) => boolean, project: (t: T) => R, ins: Stream<T>); | ||
@@ -248,2 +286,3 @@ _n(v: T): void; | ||
ins: Stream<T>; | ||
type: string; | ||
private out; | ||
@@ -260,2 +299,3 @@ constructor(val: R, ins: Stream<T>); | ||
ins: Stream<T>; | ||
type: string; | ||
private out; | ||
@@ -272,2 +312,3 @@ constructor(fn: (err: any) => Stream<T>, ins: Stream<T>); | ||
value: T; | ||
type: string; | ||
private out; | ||
@@ -281,2 +322,3 @@ constructor(ins: Stream<T>, value: T); | ||
ins: Stream<T>; | ||
type: string; | ||
private out; | ||
@@ -721,3 +763,3 @@ private taken; | ||
*/ | ||
flatten<R, T extends Stream<R>>(): T; | ||
flatten<R>(): T; | ||
/** | ||
@@ -748,3 +790,3 @@ * Flattens a "stream of streams", handling multiple concurrent nested streams | ||
*/ | ||
flattenConcurrently<R, T extends Stream<R>>(): T; | ||
flattenConcurrently<R>(): T; | ||
/** | ||
@@ -817,5 +859,5 @@ * Blends two streams together, emitting events from both. | ||
* | ||
* @return {Stream} | ||
* @return {MemoryStream} | ||
*/ | ||
remember(): Stream<T>; | ||
remember(): MemoryStream<T>; | ||
/** | ||
@@ -889,7 +931,7 @@ * Changes this current stream to imitate the `other` given stream. | ||
export class MemoryStream<T> extends Stream<T> { | ||
private _val; | ||
private _v; | ||
private _has; | ||
constructor(producer: InternalProducer<T>); | ||
_n(x: T): void; | ||
_add(listener: InternalListener<T>): void; | ||
_add(il: InternalListener<T>): void; | ||
} | ||
@@ -896,0 +938,0 @@ export default Stream; |
Sorry, the diff of this file is not supported yet
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
404872
9593
0