diff --git a/stream/bars.js b/stream/bars.js index cef8cba..9c2c86b 100644 --- a/stream/bars.js +++ b/stream/bars.js @@ -1,12 +1,13 @@ - -const normal = '▒' -const crazy = '▇' -export default (valuefn=(ary)=>ary.length, threshold=100, yellowbox=false)=>events=>events.do( - (infoAry)=>{ - const len = valuefn(infoAry) - if(yellowbox && len >= threshold){ - console.warn(`bars: event rate over threshold (${threshold}): ${len}`) +const normal = '▒'; +const crazy = '▇'; +export default (valuefn = ary => ary.length, threshold = 100, yellowbox = false) => events => events.do( + infoAry => { + const len = valuefn(infoAry); + if (yellowbox && len >= threshold) { + console.warn(`bars: event rate over threshold (${threshold}): ${len}`); } - console.log("tick", (len >= threshold ? crazy : normal).repeat(Math.floor(Math.log(Math.max(len,1)))) + `(${len})`) + console.log('tick', (len >= threshold ? + crazy + : normal).repeat(Math.floor(Math.log(Math.max(len, 1)))) + `(${len})`); } - ) + ); diff --git a/stream/index.js b/stream/index.js index 533853d..ddf770a 100644 --- a/stream/index.js +++ b/stream/index.js @@ -4,13 +4,11 @@ import 'rxjs/add/operator/filter'; import 'rxjs/add/operator/do'; import 'rxjs/add/operator/bufferTime'; -import { spy as log } from '../log' - class Stream { constructor (emitter) { - this.events = Observable.fromEvent(emitter, 'mqspy') - this.spy = (info) => emitter.emit('mqspy', info) + this.events = Observable.fromEvent(emitter, 'mqspy'); + this.spy = info => emitter.emit('mqspy', info); } } -export default Stream +export default Stream;