mirror of
https://github.com/FranP-code/Hangman-game-with-React.git
synced 2025-10-13 00:42:32 +00:00
4 lines
229 B
JavaScript
4 lines
229 B
JavaScript
const capitalize = (str, lower = false) =>
|
|
(lower ? str.toLowerCase() : str).replace(/(?:^|\s|["'([{])+\S/g, match => match.toUpperCase()); /* CREDITS: https://stackoverflow.com/a/7592235*/
|
|
|
|
export default capitalize |