es-toolkit
Version:
A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.
14 lines (11 loc) • 346 B
JavaScript
import { capitalize } from './capitalize.mjs';
import { words } from './words.mjs';
function camelCase(str) {
const words$1 = words(str);
if (words$1.length === 0) {
return '';
}
const [first, ...rest] = words$1;
return `${first.toLowerCase()}${rest.map(word => capitalize(word)).join('')}`;
}
export { camelCase };