Last active
December 16, 2016 21:07
-
-
Save jsdev/8305476 to your computer and use it in GitHub Desktop.
spacedOut method: takes a TitleCased or camelCased string and returns with appropriate spaces
This file contains 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
const spacedOut = str => str.replace(/^[a-z]|[A-Z]/g, (v, i) => i === 0 ? v : " " + v); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
would take title cased or camel cased strings and turn them into spaced out, so adds a space before Uppercase letters that directly follow a lowercase letter