< Back to list

Snippets

JS

Map Replace Snippets

Useful for using with https://marketplace.visualstudio.com/items?itemName=Yukai.map-replace-js

camelCase -> Sentence Case

(v, i) => `${v[0].toUpperCase()}${v.slice(1).replace( /([A-Z])/g, " $1" )}`

snake_case -> camelCase

(v, i) => `${v.replace(/([-_][a-z])/g, (group) => group.toUpperCase().replace('-', '').replace('_', ''))}`