mirror of
https://github.com/wassname/talk.git
synced 2026-06-29 23:43:19 +08:00
17 lines
283 B
JavaScript
17 lines
283 B
JavaScript
const regExp = /[-\s]+(.)?/g;
|
|
|
|
/**
|
|
* Convert dash separated strings to camel case.
|
|
*
|
|
* @param {String} str
|
|
* @return {String}
|
|
*/
|
|
|
|
export default function camelize(str) {
|
|
return str.replace(regExp, toUpper);
|
|
}
|
|
|
|
function toUpper(match, c) {
|
|
return c ? c.toUpperCase() : '';
|
|
}
|