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
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
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.
The module is published in the public npm registry and can be installed by running:
install --save diffset
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
.
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);
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
MIT