Use jsDoc comments in front-end scripts

This commit is contained in:
2017-07-01 01:08:54 -07:00
parent b8a502def6
commit 0a99ad1db5
3 changed files with 45 additions and 22 deletions

View File

@@ -1,4 +1,8 @@
// the most terrible camelizer on the internet, guaranteed!
/**
* the most terrible camelizer on the internet, guaranteed!
* @param {string} str String that isn't camel-case, e.g., CAMeL_CaSEiS-harD
* @return {string} String converted to camel-case, e.g., camelCaseIsHard
*/
export default str => `${str.charAt(0).toLowerCase()}${str.replace(/[\W_]/g, '|').split('|')
.map(part => `${part.charAt(0).toUpperCase()}${part.slice(1)}`)
.join('')