I want to be able to use HashIDs in my project. With HashIDs you can create hash IDs from either one or n-number of integers, like so:
encrypt(1);
encrypt(1,2,3,4);
encrypt(1,2,...n);
This works fine for one variable already, but unfortunately I'm sometimes receiving a string of comma separated numbers that I'd wish to encode. So it would be "1,2,3,4,5".
Of course I can easily turn that into an array, but an array doesn't help, as I'd still need to pass the valuables individually to encrypt. And since I do not know how many integers there are in the string, I do not know how I can implement that.
Coincidentally, PHP has a way for dealing with that exact same problem.
How could I achieve this in JavaScript?