Last active
April 8, 2018 03:16
-
-
Save haipeng/1b380b15e763d1abefa844338f3be062 to your computer and use it in GitHub Desktop.
capitalize
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 capitalize (word) { | |
return (word || '').replace(/^([a-z])/, w => w.toUpperCase()); | |
} |
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 uncapitalize (word) { | |
return (word || '').replace(/^([A-Z])/, w => w.toLowerCase()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment