observing/diffset

Name: diffset

Owner: Observe.it

Description: Progressively calculate and store the differences between the previous added values.

Created: 2017-05-30 23:58:23.0

Updated: 2017-05-30 23:58:35.0

Pushed: 2017-05-31 18:56:56.0

Homepage: null

Size: 4

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

diffset

A small set numbers where only the diff of the previously added value is stored. So if your previous value was 120 and you store 123 it will only store the number 3.

Installation

The module is published in the public npm registry and can be installed by running:

install --save diffset
API
Diffset = require('diffset');

ds = new Diffset(100);

In the example above we import the diffset module and give it a starting value of 100. If no starting value is provided it will default to 0.

push

Add a new value to the set, the method accepts multiple arguments if you want to do a bulk add.

ush(120, 122, 130, 100, 101);
ush(111);
flush

Clear the internally stored diff set that you created by pushing in new values and return a copy of the data.

data = ds.flush();
ole.log(data) // 20, 2, 8, -30, 1, 10
License

MIT


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.