Are functions as replacement supported? I would love to be able to use my RunlengthEncoding snippets.
let RLE = {
enc: t => t.replace(/([^\d])\1*/g, m => m.length > 1 ? m.length + m[0] : m[0]),
dec: t => t.replace(/(\d+)([^\d])/g, (m, r, c) => new Array(+r + 1).join(c))
}
-- Edit --
I did flash this version on my espruino wifi and it seems to work!
But i run into LOW MEMORY issues while using RLE.dec with a ~5k chars long string.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Are functions as replacement supported? I would love to be able to use my RunlengthEncoding snippets.
-- Edit --
I did flash this version on my espruino wifi and it seems to work!
But i run into LOW MEMORY issues while using RLE.dec with a ~5k chars long string.