Compress a string contains only number character.
const {
compress,
uncompress
} = require('@z9i/compress-number-string');
const text = '3213434321412431531565757877963160';
const compressed = compress(text);
const uncompressed = uncompress(compressed);
console.log(text, compressed, uncompressed, text === uncompressed);
- comporess: no leading zero, length should greater then 15.
- uncompress: should contain
_
.
- Ignore leading or trailing
_
for uncompress. - Ensure compress value is a string.
Base support for compress and uncompress number string.
MIT.