solutions

This commit is contained in:
Cody Loyd
2017-12-15 13:26:05 -06:00
parent 7facb382ac
commit 02d2ca43f4
2 changed files with 35 additions and 18 deletions
+17 -3
View File
@@ -1,5 +1,19 @@
var snakeCase = function() {
const snakeCase = function(string) {
// wtf case
string = string.replace(/\.\./g, " ");
}
// this splits up camelcase IF there are no spaces in the word
if (string.indexOf(" ") < 0) {
string = string.replace(/([A-Z])/g, " $1");
}
module.exports = snakeCase
return string
.trim()
.toLowerCase()
.replace(/[,\?\.]/g, "")
.replace(/\-/g, " ")
.split(" ")
.join("_");
};
module.exports = snakeCase;