Run length encode and decoder
Installation
npm install --save run-length
Example
Works on arrays and is for repeated sequences.
; // generate array with repeated sequence as demo;; console.logarr;// [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]console.logencodearr;// [ [ 15, 1 ], [ 15, 0 ] ]console.logdecodeencodearr;// [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
Author
Dugagjin Lashi
License
MIT