-
Notifications
You must be signed in to change notification settings - Fork 0
Library: toTitleCase()
Eugene Lazutkin edited this page Jul 11, 2018
·
1 revision
toTitleCase() module is a function, which extracts words from a string (using /\w+/ as a lexer) and capitalizes them.
In a module-enabled environment (like Babel) it can be accessed like that:
import toTitleCase from '@researchnow/reno/src/utils/toTitleCase';In global-based environments (like a browser) it is frequently mapped to Reno.utils.toTitleCase.
The function takes the following arguments:
-
stris a string to be parsed for words and capitalized.
It returns a string where words are capitalized.
assert(toTitleCase('one - TWO tHrEe') === 'One - Two Three');