Spinal Tap Case Improvement

Hi!

I’m pretty new here (first post). I was doing the spinal tap problem and wanted to make a teeny improvement on the advanced solution but the guide seems to be locked (or I just can’t find the reply button).

This is the old solution

str.split(/\s|_|(?=[A-Z])/)
       .join('-')
       .toLowerCase()

It splits on single whitespaces OR underscores OR whenever the character is succeeded by an uppercase letter.

We can make it more general by changing the initial regex:

str.split(/(?=[A-Z])|[^a-z^A-Z]+/)
            .join('-')
            .toLowerCase()

It splits on any number of non alphabet characters or whenever the character is succeeded by an uppercase letter.

Add test:
spinalCase('This_Is__()*!@SpinalCase@Now');

I think the theoretical purpose for this specific function is to make file names and paths universally compatible with various file systems (Windows, Mac, Linux, Git, npm, and many more). So I would at least allow numbers.

Still, nice job.