numeric-sequence-compressor
v1.0.6
Published
Numeric array compressor Compression quality is ~ 2 times better than the original separator-separated sequence of numbers
Maintainers
Readme
Numeric sequence compressor
Numeric array compressor Compression quality is ~ 2 times better than the original separator-separated sequence of numbers
Important! The algorithm works correctly when the range of numbers in the array is from 0 to 1000.
Example
Install
npm i numeric-sequence-compressorImport dependency to Your project:
const { serialize, deserialize } = require('numeric-sequence-compressor');Serialization (Compression):
const arr = [0, 100, 25, 7, 47, 666];
const compressed = serialize(arr);
console.log(compressed); // "0-34P7-1fkq"Deserialization (Decompression):
const compressed = "0-34P7-1fkq";
const arr = deserialize(compressed);
console.log(arr); // "[0, 100, 25, 7, 47, 666]"Tests & benchmark
To run the benchmark with tests, run the command:
npm startили
npm run test