mirror of
https://github.com/toss/es-toolkit.git
synced 2024-11-28 12:05:41 +03:00
695 B
695 B
camelCase
Converts a string to camel case.
Camel case is a naming convention in which the first word is in lower case and each subsequent word is capitalized. For example, camelCase
.
Signature
function camelCase(str: string): string;
Parameters
str
(string
): The string that is to be changed to camel case.
Returns
(string
) The converted string to camel case.
Examples
import { camelCase } from 'es-toolkit/string';
camelCase('camelCase'); // returns 'camelCase'
camelCase('some whitespace'); // returns 'someWhitespace'
camelCase('hyphen-text'); // returns 'hyphenText'
camelCase('HTTPRequest'); // returns 'httpRequest'