diff --git a/docs/.vitepress/en.mts b/docs/.vitepress/en.mts index 873f0712..d8d542d7 100644 --- a/docs/.vitepress/en.mts +++ b/docs/.vitepress/en.mts @@ -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' }, + ], + } ], }, ]; diff --git a/docs/.vitepress/ko.mts b/docs/.vitepress/ko.mts index 4e7ff589..8f94ccb6 100644 --- a/docs/.vitepress/ko.mts +++ b/docs/.vitepress/ko.mts @@ -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' }, + ], + } ], }, ]; diff --git a/docs/ko/reference/object/set.md b/docs/ko/reference/compat/object/set.md similarity index 86% rename from docs/ko/reference/object/set.md rename to docs/ko/reference/compat/object/set.md index a10eeaab..8826bf22 100644 --- a/docs/ko/reference/object/set.md +++ b/docs/ko/reference/compat/object/set.md @@ -1,5 +1,9 @@ # set +::: info +[lodash와 호환](../../compatibility.md)되는 `es-toolkit/compat` 라이브러리에서 쓸 수 있어요. +::: + 지정된 경로에 주어진 값을 설정해요. 경로의 일부가 존재하지 않으면 생성됩니다. ## Signature @@ -21,6 +25,8 @@ function set(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); diff --git a/docs/reference/object/set.md b/docs/reference/compat/object/set.md similarity index 86% rename from docs/reference/object/set.md rename to docs/reference/compat/object/set.md index e50d0d3b..be20b74b 100644 --- a/docs/reference/object/set.md +++ b/docs/reference/compat/object/set.md @@ -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(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); diff --git a/src/compat/index.ts b/src/compat/index.ts index 4238f9bd..d78a4279 100644 --- a/src/compat/index.ts +++ b/src/compat/index.ts @@ -25,3 +25,4 @@ export * from '../index.ts'; export { chunk } from './array/chunk.ts'; +export { set } from './object/set.ts'; diff --git a/src/object/set.spec.ts b/src/compat/object/set.spec.ts similarity index 100% rename from src/object/set.spec.ts rename to src/compat/object/set.spec.ts diff --git a/src/object/set.ts b/src/compat/object/set.ts similarity index 100% rename from src/object/set.ts rename to src/compat/object/set.ts