Skip to content

Commit

Permalink
Spinal Tap Case
Browse files Browse the repository at this point in the history
Convert a string to spinal case. Spinal case is all-lowercase-words-joined-by-dashes.
  • Loading branch information
DonGallagher committed Oct 15, 2016
1 parent e800d58 commit 67bd96d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Spinal Tap Case
@@ -0,0 +1,7 @@
function spinalCase(str) {
str = str.replace(/([a-z])([A-Z])/g, '$1 $2');
str=str.replace(/[ _]/g, '-').toLowerCase();
return str;
}

spinalCase("thisIs_Spinal Tap");

0 comments on commit 67bd96d

Please sign in to comment.