pressbooks aldine theme the theme used for the front page or default book
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 lines
432 B

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