Data Compression – What's the best way to compress a string using just numbers and commas with JavaScript?

I have a string like this:


And I am sure that it complies with the following rules:

  1. Just , and 0123456789 it.
  2. No number will be greater than 999, that is, they are all 1,2 or 3 digits.

Are there simple functions that allow me to compress / decompress the data with JavaScript?

For example, I can think very stupid to convert any number to base 16 or even base 36 base.