Nickel Palladium Manganese

    simplemovingaverage

    1.1.2 • Public • Published

    simplemovingaverage.js

    Simple moving average time series smoothing in JavaScript.

    Build Status Codacy npm npm Dependency Status MIT license

    Install

    $ npm install simplemovingaverage
    

    Usage

    Node.js

    var SimpleMovingAverage = require("simplemovingaverage");
    var sma = new SimpleMovingAverage();
    var setTimeSeries = [1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6];
    var intWindowSize = 2;
    sma.get(setTimeSeries, intWindowSize);
    // => [1.5,3.5,5.5,7.5,9.5,1.5,3.5,5.5]

    Browser

    (Add necessary <script> tag reference to simplemovingaverage.js)

    // SimpleMovingAverage is autoloaded to window.SimpleMovingAverage
    var sma = new SimpleMovingAverage();
    var setTimeSeries = [1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6];
    var intWindowSize = 2;
    sma.get(setTimeSeries, intWindowSize);
    // => [1.5,3.5,5.5,7.5,9.5,1.5,3.5,5.5]

    Tests

    Gulp + Karma + PhantomJS + Jasmine

    $ gulp

    License

    MIT. By Josh Ause.

    Install

    npm i simplemovingaverage

    DownloadsWeekly Downloads

    15

    Version

    1.1.2

    License

    MIT

    Last publish

    Collaborators

    • joshause