Created
February 20, 2019 10:00
-
-
Save w10t/2029ad7afde1f6cdcb11e6310edf85e9 to your computer and use it in GitHub Desktop.
humps decamelizeKeys split by numbers (e.g. someField11 -> some_field_11)
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
| function decamelize(string) { | |
| return humps.decamelizeKeys(string, { | |
| process: string2 => string2.split(/(?=[A-Z])/).join('_').toLowerCase().replace(/(\d+)/g, '_$1') }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment