npm stats
  • Search
  • About
  • Repo
  • Sponsor
  • more
    • Search
    • About
    • Repo
    • Sponsor

Made by Antonio Ramirez

avg-stream

0.0.1

@soldair

npmHomeRepoSnykSocket
Downloads:0
$ npm install avg-stream
DailyWeeklyMonthlyYearly

Build Status

avg-stream

average the last n samples and emit the result as a stream

var avg = require('avg-stream');

var s = avg(2);

s.on('data',function(d){
  console.log(d);
})

s.write({a:1,b:2})
s.write({a:3,b:1})
s.write({a:2,b:4})

output

{ a: 1, b: 2 }
{ a: 2, b: 1.5 }
{ a: 2.5, b: 2.5 }