Test migration to jest by hand
Apparently using regular expressions is way easier.
This commit is contained in:
7
test/toSnakeCase/toSnakeCase.js
Normal file
7
test/toSnakeCase/toSnakeCase.js
Normal file
@ -0,0 +1,7 @@
|
||||
const toSnakeCase = 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 = toSnakeCase;
|
||||
Reference in New Issue
Block a user