Test migration to jest by hand
Apparently using regular expressions is way easier.
This commit is contained in:
6
test/fromCamelCase/fromCamelCase.js
Normal file
6
test/fromCamelCase/fromCamelCase.js
Normal file
@ -0,0 +1,6 @@
|
||||
const fromCamelCase = (str, separator = '_') =>
|
||||
str
|
||||
.replace(/([a-z\d])([A-Z])/g, '$1' + separator + '$2')
|
||||
.replace(/([A-Z]+)([A-Z][a-z\d]+)/g, '$1' + separator + '$2')
|
||||
.toLowerCase();
|
||||
module.exports = fromCamelCase;
|
||||
Reference in New Issue
Block a user