/**
 * Converts string to camel case
 *
 * @param {string} string
 * @returns {string} A camelized string
 */
export const toCamelCase = <T extends string>(string: T) =>
  string.replace(/^([A-Z])|[\s-_]+(\w)/g, (match, p1, p2) =>
    p2 ? p2.toUpperCase() : p1.toLowerCase(),
  );
