Created
May 5, 2017 19:56
-
-
Save cacheflow/e515bafdac05b941323a7e63720c42b1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let converter = { | |
camelToSnake (data) { | |
return data.replace(/([A-Z])/g, (val) => "_" + val.toLowerCase()) | |
}, | |
snakeToCamel (data) { | |
return data.replace(/_([a-z])/g, function (g) { return g[1].toUpperCase(); }); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment