chore: Move set to our compat library
Some checks are pending
CI / codecov (push) Waiting to run
Release / release (push) Waiting to run

This commit is contained in:
raon0211 2024-07-18 10:07:01 +09:00
parent b9432e1cfd
commit 2168a67045
7 changed files with 25 additions and 2 deletions

View File

@ -138,7 +138,6 @@ function sidebar(): DefaultTheme.Sidebar {
{ text: 'pick', link: '/reference/object/pick' },
{ text: 'pickBy', link: '/reference/object/pickBy' },
{ text: 'invert', link: '/reference/object/invert' },
{ text: 'set', link: '/reference/object/set' },
],
},
{
@ -166,6 +165,12 @@ function sidebar(): DefaultTheme.Sidebar {
{ text: 'capitalize', link: '/reference/string/capitalize' },
],
},
{
text: 'Compatibility Libraries',
items: [
{ text: 'set', link: '/reference/compat/object/set' },
],
}
],
},
];

View File

@ -149,7 +149,6 @@ function sidebar(): DefaultTheme.Sidebar {
{ text: 'pick', link: '/ko/reference/object/pick' },
{ text: 'pickBy', link: '/ko/reference/object/pickBy' },
{ text: 'invert', link: '/ko/reference/object/invert' },
{ text: 'set', link: '/ko/reference/object/set' },
],
},
{
@ -180,6 +179,12 @@ function sidebar(): DefaultTheme.Sidebar {
{ text: 'capitalize', link: '/ko/reference/string/capitalize' },
],
},
{
text: '호환성 라이브러리',
items: [
{ text: 'set', link: '/reference/compat/object/set' },
],
}
],
},
];

View File

@ -1,5 +1,9 @@
# set
::: info
[lodash와 호환](../../compatibility.md)되는 `es-toolkit/compat` 라이브러리에서 쓸 수 있어요.
:::
지정된 경로에 주어진 값을 설정해요. 경로의 일부가 존재하지 않으면 생성됩니다.
## Signature
@ -21,6 +25,8 @@ function set<T>(obj: Settable, path: Path, value: any): T;
## Examples
```typescript
import { set } from 'es-toolkit/compat';
// 중첩된 객체에 값 설정
const obj = { a: { b: { c: 3 } } };
set(obj, 'a.b.c', 4);

View File

@ -1,5 +1,9 @@
# set
::: info
This is available in our [compatibility library](../../compatibility.md), `es-toolkit/compat`.
:::
Sets the given value at the specified path of the object. If any part of the path does not exist, it will be created.
## Signature
@ -21,6 +25,8 @@ function set<T>(obj: Settable, path: Path, value: any): T;
## Examples
```typescript
import { set } from 'es-toolkit/compat';
// Set a value in a nested object
const obj = { a: { b: { c: 3 } } };
set(obj, 'a.b.c', 4);

View File

@ -25,3 +25,4 @@
export * from '../index.ts';
export { chunk } from './array/chunk.ts';
export { set } from './object/set.ts';