Test migration to jest by hand
Apparently using regular expressions is way easier.
This commit is contained in:
7
test/toKebabCase/toKebabCase.js
Normal file
7
test/toKebabCase/toKebabCase.js
Normal file
@@ -0,0 +1,7 @@
|
||||
const toKebabCase = str =>
|
||||
str &&
|
||||
str
|
||||
.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g)
|
||||
.map(x => x.toLowerCase())
|
||||
.join('-');
|
||||
module.exports = toKebabCase;
|
||||
Reference in New Issue
Block a user