{"version":3,"file":"camelCase-zSjbdRoI.cjs","names":["capitalize"],"sources":["../src/functions/camelCase/camelCase.ts"],"sourcesContent":["import type { CamelCase as CamelCaseImplementation } from 'type-fest';\n\nimport { capitalize } from '../capitalize';\n\n/**\n * Changes the casing of a string to kebab case.\n * @param string The input string to change the casing of.\n * @returns A new string with the casing changed to kebab case.\n * @example\n * ```ts\n * camelCase('fooBar') // 'fooFar'\n * camelCase('foo bar') // 'fooBar'\n * camelCase('foo-bar') // 'fooBar'\n * camelCase('fooBar42') // 'fooBar42'\n * ```\n */\nexport function camelCase<S extends string>(string: S): CamelCase<S> {\n  if (!/[a-z]+/i.test(string)) {\n    return string as CamelCase<S>;\n  }\n\n  const words = string.trim().split(wordsRegex);\n  return words\n    .map((word, index) => (index === 0 ? word.toLowerCase() : capitalize(word)))\n    .join('') as CamelCase<S>;\n}\n\n/**\n * Changes the casing of a string to camel case.\n * @see {@link camelCase}.\n */\nexport type CamelCase<S extends string> = CamelCaseImplementation<S>;\n\nconst wordsRegex = /[\\s_-]+|(?<=[a-z])(?=[A-Z])/;\n"],"mappings":";;;;;;;;;;;;;;;AAgBA,SAAgB,UAA4B,QAAyB;AACnE,KAAI,CAAC,UAAU,KAAK,OAAO,CACzB,QAAO;AAIT,QADc,OAAO,MAAM,CAAC,MAAM,WAAW,CAE1C,KAAK,MAAM,UAAW,UAAU,IAAI,KAAK,aAAa,GAAGA,8BAAW,KAAK,CAAE,CAC3E,KAAK,GAAG;;AASb,MAAM,aAAa"}