es-toolkit/docs/reference/string/camelCase.md

31 lines
695 B
Markdown
Raw Normal View History

2024-07-14 11:23:57 +03:00
# 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
```typescript
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
```typescript
import { camelCase } from 'es-toolkit/string';
camelCase('camelCase'); // returns 'camelCase'
camelCase('some whitespace'); // returns 'someWhitespace'
camelCase('hyphen-text'); // returns 'hyphenText'
camelCase('HTTPRequest'); // returns 'httpRequest'
```