Skip to content

Commit 2b97207

Browse files
committed
docs(toCamelCaseKeys): document uppercase and PascalCase key conversion
1 parent b580799 commit 2b97207

File tree

4 files changed

+37
-1
lines changed

4 files changed

+37
-1
lines changed

docs/ja/reference/object/toCamelCaseKeys.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ const camelCased = toCamelCaseKeys(obj);
1212

1313
### `toCamelCaseKeys(obj)`
1414

15-
オブジェクトのすべてのキーをキャメルケースに変換したい時に`toCamelCaseKeys`を使用してください。ネストされたオブジェクトと配列内のオブジェクトも再帰的に変換されます。
15+
オブジェクトのすべてのキーをキャメルケースに変換したい時に `toCamelCaseKeys` を使用してください。ネストされたオブジェクトと配列内のオブジェクトも再帰的に変換されます。
16+
17+
- `snake_case``camelCase`(例: `user_id``userId`
18+
- `PascalCase``camelCase`(例: `UserId``userId`
19+
- `ALL_CAPS``camelCase`(例: `FIRST_NAME``firstName`, `LAST``last`
1620

1721
```typescript
1822
import { toCamelCaseKeys } from 'es-toolkit/object';
@@ -50,6 +54,11 @@ const nestedResult = toCamelCaseKeys(nested);
5054
// }
5155
// }
5256
// }になります
57+
58+
// PascalCase と ALL_CAPS のキーも変換されます
59+
const raw = { UserId: 1, FIRST_NAME: 'JinHo', LAST: 'Yeom' };
60+
const converted = toCamelCaseKeys(raw);
61+
// converted は { userId: 1, firstName: 'JinHo', last: 'Yeom' } になります
5362
```
5463

5564
#### パラメータ

docs/ko/reference/object/toCamelCaseKeys.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ const camelCased = toCamelCaseKeys(obj);
1414

1515
객체의 모든 키를 카멜 케이스로 변환하고 싶을 때 `toCamelCaseKeys`를 사용하세요. 중첩된 객체와 배열 내의 객체들도 재귀적으로 변환돼요.
1616

17+
- `snake_case``camelCase` (예: `user_id``userId`)
18+
- `PascalCase``camelCase` (예: `UserId``userId`)
19+
- `ALL_CAPS``camelCase` (예: `FIRST_NAME``firstName`, `LAST``last`)
20+
1721
```typescript
1822
import { toCamelCaseKeys } from 'es-toolkit/object';
1923

@@ -50,6 +54,11 @@ const nestedResult = toCamelCaseKeys(nested);
5054
// }
5155
// }
5256
// }가 돼요
57+
58+
// PascalCase와 ALL_CAPS 키도 변환돼요
59+
const raw = { UserId: 1, FIRST_NAME: 'JinHo', LAST: 'Yeom' };
60+
const converted = toCamelCaseKeys(raw);
61+
// converted는 { userId: 1, firstName: 'JinHo', last: 'Yeom' }가 돼요
5362
```
5463

5564
#### 파라미터

docs/reference/object/toCamelCaseKeys.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ const camelCased = toCamelCaseKeys(obj);
1414

1515
Use `toCamelCaseKeys` when you want to convert all keys of an object to camel case. Nested objects and objects within arrays are also converted recursively.
1616

17+
- `snake_case``camelCase` (e.g. `user_id``userId`)
18+
- `PascalCase``camelCase` (e.g. `UserId``userId`)
19+
- `ALL_CAPS``camelCase` (e.g. `FIRST_NAME``firstName`, `LAST``last`)
20+
1721
```typescript
1822
import { toCamelCaseKeys } from 'es-toolkit/object';
1923

@@ -50,6 +54,11 @@ const nestedResult = toCamelCaseKeys(nested);
5054
// }
5155
// }
5256
// }
57+
58+
// PascalCase and ALL_CAPS keys are also converted
59+
const raw = { UserId: 1, FIRST_NAME: 'JinHo', LAST: 'Yeom' };
60+
const converted = toCamelCaseKeys(raw);
61+
// converted is { userId: 1, firstName: 'JinHo', last: 'Yeom' }
5362
```
5463

5564
#### Parameters

docs/zh_hans/reference/object/toCamelCaseKeys.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ const camelCased = toCamelCaseKeys(obj);
1414

1515
当您想要将对象的所有键转换为驼峰命名法时,请使用 `toCamelCaseKeys`。嵌套对象和数组中的对象也会递归转换。
1616

17+
- `snake_case``camelCase`(例如 `user_id``userId`
18+
- `PascalCase``camelCase`(例如 `UserId``userId`
19+
- `ALL_CAPS``camelCase`(例如 `FIRST_NAME``firstName`, `LAST``last`
20+
1721
```typescript
1822
import { toCamelCaseKeys } from 'es-toolkit/object';
1923

@@ -50,6 +54,11 @@ const nestedResult = toCamelCaseKeys(nested);
5054
// }
5155
// }
5256
// }
57+
58+
// PascalCase 和 ALL_CAPS 的键也会被转换
59+
const raw = { UserId: 1, FIRST_NAME: 'JinHo', LAST: 'Yeom' };
60+
const converted = toCamelCaseKeys(raw);
61+
// converted 是 { userId: 1, firstName: 'JinHo', last: 'Yeom' }
5362
```
5463

5564
#### 参数

0 commit comments

Comments
 (0)