From 3f407712e4f0efeaa877b812ddf81b22f6d93668 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=ED=95=B4=EC=A4=80?= <99087502+haejunejung@users.noreply.github.com> Date: Mon, 15 Jul 2024 09:43:42 +0900 Subject: [PATCH] docs(isEqual): Add isEqual docs (#200) --- benchmarks/isEqual.bench.ts | 55 ++++++ docs/.vitepress/en.mts | 209 ++++++++++----------- docs/.vitepress/ko.mts | 248 ++++++++++++------------- docs/ko/reference/predicate/isEqual.md | 89 +++++++++ docs/reference/predicate/isEqual.md | 14 +- 5 files changed, 385 insertions(+), 230 deletions(-) create mode 100644 benchmarks/isEqual.bench.ts create mode 100644 docs/ko/reference/predicate/isEqual.md diff --git a/benchmarks/isEqual.bench.ts b/benchmarks/isEqual.bench.ts new file mode 100644 index 00000000..f0b0a304 --- /dev/null +++ b/benchmarks/isEqual.bench.ts @@ -0,0 +1,55 @@ +import { bench, describe } from 'vitest'; +import { isEqual as isEqualToolkit } from 'es-toolkit'; +import { isEqual as isEqualLodash } from 'lodash'; + +describe('isEqual', () => { + bench('es-toolkit/isEqual', () => { + isEqualToolkit(1, 1); + isEqualToolkit('hello', 'hello'); + isEqualToolkit(true, true); + + isEqualToolkit('hello', 'world'); + isEqualToolkit(true, false); + + isEqualToolkit(NaN, NaN); + isEqualToolkit(+0, -0); + + isEqualToolkit(new Date('2020-01-01'), new Date('2020-01-01')); + isEqualToolkit(new Date('2020-01-01'), new Date('2021-01-01')); + + isEqualToolkit(/hello/g, /hello/g); + isEqualToolkit(/hello/g, /hello/i); + + isEqualToolkit({ a: 1, b: { c: 2 } }, { a: 1, b: { c: 2 } }); + isEqualToolkit({ a: 1, b: { c: 2 } }, { a: 1, b: { c: 3 } }); + isEqualToolkit({ a: 1, b: 2 }, { a: 1, b: 2 }); + + isEqualToolkit([1, 2, 3], [1, 2, 3]); + isEqualToolkit([1, 2, 3], [1, 2, 4]); + }); + + bench('lodash/isEqual', () => { + isEqualLodash(1, 1); + isEqualLodash('hello', 'hello'); + isEqualLodash(true, true); + + isEqualLodash('hello', 'world'); + isEqualLodash(true, false); + + isEqualLodash(NaN, NaN); + isEqualLodash(+0, -0); + + isEqualLodash(new Date('2020-01-01'), new Date('2020-01-01')); + isEqualLodash(new Date('2020-01-01'), new Date('2021-01-01')); + + isEqualLodash(/hello/g, /hello/g); + isEqualLodash(/hello/g, /hello/i); + + isEqualLodash({ a: 1, b: { c: 2 } }, { a: 1, b: { c: 2 } }); + isEqualLodash({ a: 1, b: { c: 2 } }, { a: 1, b: { c: 3 } }); + isEqualLodash({ a: 1, b: 2 }, { a: 1, b: 2 }); + + isEqualLodash([1, 2, 3], [1, 2, 3]); + isEqualLodash([1, 2, 3], [1, 2, 4]); + }); +}); diff --git a/docs/.vitepress/en.mts b/docs/.vitepress/en.mts index 92953c52..5cc11c00 100644 --- a/docs/.vitepress/en.mts +++ b/docs/.vitepress/en.mts @@ -1,9 +1,9 @@ -import { type DefaultTheme, defineConfig } from "vitepress"; +import { type DefaultTheme, defineConfig } from 'vitepress'; export const en = defineConfig({ - lang: "en", + lang: 'en', description: - "A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.", + 'A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.', themeConfig: { nav: nav(), @@ -11,12 +11,12 @@ export const en = defineConfig({ sidebar: sidebar(), editLink: { - pattern: "https://github.com/toss/es-toolkit/edit/main/docs/:path", - text: "Edit this page on GitHub", + pattern: 'https://github.com/toss/es-toolkit/edit/main/docs/:path', + text: 'Edit this page on GitHub', }, footer: { - message: "Released under the MIT License.", + message: 'Released under the MIT License.', copyright: `Copyright © ${new Date().getFullYear()} Viva Republica, Inc.`, }, }, @@ -24,141 +24,142 @@ export const en = defineConfig({ function nav(): DefaultTheme.NavItem[] { return [ - { text: "Home", link: "/" }, - { text: "Introduction", link: "/intro" }, - { text: "Reference", link: "/reference/array/chunk" }, + { text: 'Home', link: '/' }, + { text: 'Introduction', link: '/intro' }, + { text: 'Reference', link: '/reference/array/chunk' }, ]; } function sidebar(): DefaultTheme.Sidebar { return [ { - text: "Guide", + text: 'Guide', items: [ - { text: "Introduction", link: "/intro" }, - { text: "Installation", link: "/installation" }, - { text: "Impact on Bundle Size", link: "/bundle-size" }, - { text: "Performance", link: "/performance" }, - { text: "Compatibility with Lodash", link: "/compatibility" }, + { text: 'Introduction', link: '/intro' }, + { text: 'Installation', link: '/installation' }, + { text: 'Impact on Bundle Size', link: '/bundle-size' }, + { text: 'Performance', link: '/performance' }, + { text: 'Compatibility with Lodash', link: '/compatibility' }, ], }, { - text: "Reference", + text: 'Reference', items: [ { - text: "Array Utilities", + text: 'Array Utilities', items: [ - { text: "chunk", link: "/reference/array/chunk" }, - { text: "countBy", link: "/reference/array/countBy" }, - { text: "compact", link: "/reference/array/compact" }, - { text: "difference", link: "/reference/array/difference" }, - { text: "differenceBy", link: "/reference/array/differenceBy" }, - { text: "differenceWith", link: "/reference/array/differenceWith" }, - { text: "drop", link: "/reference/array/drop" }, - { text: "dropWhile", link: "/reference/array/dropWhile" }, - { text: "dropRight", link: "/reference/array/dropRight" }, - { text: "dropRightWhile", link: "/reference/array/dropRightWhile" }, - { text: "fill", link: "/reference/array/fill" }, - { text: "toFilled", link: "/reference/array/toFilled" }, - { text: "flatten", link: "/reference/array/flatten" }, - { text: "flattenDeep", link: "/reference/array/flattenDeep" }, - { text: "forEachRight", link: "/reference/array/forEachRight" }, - { text: "groupBy", link: "/reference/array/groupBy" }, - { text: "intersection", link: "/reference/array/intersection" }, - { text: "intersectionBy", link: "/reference/array/intersectionBy" }, + { text: 'chunk', link: '/reference/array/chunk' }, + { text: 'countBy', link: '/reference/array/countBy' }, + { text: 'compact', link: '/reference/array/compact' }, + { text: 'difference', link: '/reference/array/difference' }, + { text: 'differenceBy', link: '/reference/array/differenceBy' }, + { text: 'differenceWith', link: '/reference/array/differenceWith' }, + { text: 'drop', link: '/reference/array/drop' }, + { text: 'dropWhile', link: '/reference/array/dropWhile' }, + { text: 'dropRight', link: '/reference/array/dropRight' }, + { text: 'dropRightWhile', link: '/reference/array/dropRightWhile' }, + { text: 'fill', link: '/reference/array/fill' }, + { text: 'toFilled', link: '/reference/array/toFilled' }, + { text: 'flatten', link: '/reference/array/flatten' }, + { text: 'flattenDeep', link: '/reference/array/flattenDeep' }, + { text: 'forEachRight', link: '/reference/array/forEachRight' }, + { text: 'groupBy', link: '/reference/array/groupBy' }, + { text: 'intersection', link: '/reference/array/intersection' }, + { text: 'intersectionBy', link: '/reference/array/intersectionBy' }, { - text: "intersectionWith", - link: "/reference/array/intersectionWith", + text: 'intersectionWith', + link: '/reference/array/intersectionWith', }, - { text: "keyBy", link: "/reference/array/keyBy" }, - { text: "minBy", link: "/reference/array/minBy" }, - { text: "maxBy", link: "/reference/array/maxBy" }, - { text: "orderBy", link: "/reference/array/orderBy" }, - { text: "partition", link: "/reference/array/partition" }, - { text: "sample", link: "/reference/array/sample" }, - { text: "sampleSize", link: "/reference/array/sampleSize" }, - { text: "shuffle", link: "/reference/array/shuffle" }, - { text: "take", link: "/reference/array/take" }, - { text: "takeWhile", link: "/reference/array/takeWhile" }, - { text: "takeRight", link: "/reference/array/takeRight" }, - { text: "takeRightWhile", link: "/reference/array/takeRightWhile" }, - { text: "union", link: "/reference/array/union" }, - { text: "unionBy", link: "/reference/array/unionBy" }, - { text: "unionWith", link: "/reference/array/unionWith" }, - { text: "uniq", link: "/reference/array/uniq" }, - { text: "uniqBy", link: "/reference/array/uniqBy" }, - { text: "uniqWith", link: "/reference/array/uniqWith" }, - { text: "unzip", link: "/reference/array/unzip" }, - { text: "unzipWith", link: "/reference/array/unzipWith" }, - { text: "without", link: "/reference/array/without" }, - { text: "xor", link: "/reference/array/xor" }, - { text: "xorBy", link: "/reference/array/xorBy" }, - { text: "xorWith", link: "/reference/array/xorWith" }, - { text: "zip", link: "/reference/array/zip" }, - { text: "zipObject", link: "/reference/array/zipObject" }, - { text: "zipWith", link: "/reference/array/zipWith" }, - { text: "head", link: "/reference/array/head" }, - { text: "tail", link: "/reference/array/tail" }, - { text: "last", link: "/reference/array/last" }, - { text: "initial", link: "/reference/array/initial" }, + { text: 'keyBy', link: '/reference/array/keyBy' }, + { text: 'minBy', link: '/reference/array/minBy' }, + { text: 'maxBy', link: '/reference/array/maxBy' }, + { text: 'orderBy', link: '/reference/array/orderBy' }, + { text: 'partition', link: '/reference/array/partition' }, + { text: 'sample', link: '/reference/array/sample' }, + { text: 'sampleSize', link: '/reference/array/sampleSize' }, + { text: 'shuffle', link: '/reference/array/shuffle' }, + { text: 'take', link: '/reference/array/take' }, + { text: 'takeWhile', link: '/reference/array/takeWhile' }, + { text: 'takeRight', link: '/reference/array/takeRight' }, + { text: 'takeRightWhile', link: '/reference/array/takeRightWhile' }, + { text: 'union', link: '/reference/array/union' }, + { text: 'unionBy', link: '/reference/array/unionBy' }, + { text: 'unionWith', link: '/reference/array/unionWith' }, + { text: 'uniq', link: '/reference/array/uniq' }, + { text: 'uniqBy', link: '/reference/array/uniqBy' }, + { text: 'uniqWith', link: '/reference/array/uniqWith' }, + { text: 'unzip', link: '/reference/array/unzip' }, + { text: 'unzipWith', link: '/reference/array/unzipWith' }, + { text: 'without', link: '/reference/array/without' }, + { text: 'xor', link: '/reference/array/xor' }, + { text: 'xorBy', link: '/reference/array/xorBy' }, + { text: 'xorWith', link: '/reference/array/xorWith' }, + { text: 'zip', link: '/reference/array/zip' }, + { text: 'zipObject', link: '/reference/array/zipObject' }, + { text: 'zipWith', link: '/reference/array/zipWith' }, + { text: 'head', link: '/reference/array/head' }, + { text: 'tail', link: '/reference/array/tail' }, + { text: 'last', link: '/reference/array/last' }, + { text: 'initial', link: '/reference/array/initial' }, ], }, { - text: "Function Utilities", + text: 'Function Utilities', items: [ - { text: "debounce", link: "/reference/function/debounce" }, - { text: "throttle", link: "/reference/function/throttle" }, - { text: "negate", link: "/reference/function/negate" }, - { text: "once", link: "/reference/function/once" }, - { text: "noop", link: "/reference/function/noop" }, + { text: 'debounce', link: '/reference/function/debounce' }, + { text: 'throttle', link: '/reference/function/throttle' }, + { text: 'negate', link: '/reference/function/negate' }, + { text: 'once', link: '/reference/function/once' }, + { text: 'noop', link: '/reference/function/noop' }, ], }, { - text: "Math Utilities", + text: 'Math Utilities', items: [ - { text: "clamp", link: "/reference/math/clamp" }, - { text: "inRange", link: "/reference/math/inRange" }, - { text: "mean", link: "/reference/math/mean" }, - { text: "meanBy", link: "/reference/math/meanBy" }, - { text: "random", link: "/reference/math/random" }, - { text: "randomInt", link: "/reference/math/randomInt" }, - { text: "range", link: "/reference/math/range" }, - { text: "round", link: "/reference/math/round" }, - { text: "sum", link: "/reference/math/sum" }, - { text: "sumBy", link: "/reference/math/sumBy" }, + { text: 'clamp', link: '/reference/math/clamp' }, + { text: 'inRange', link: '/reference/math/inRange' }, + { text: 'mean', link: '/reference/math/mean' }, + { text: 'meanBy', link: '/reference/math/meanBy' }, + { text: 'random', link: '/reference/math/random' }, + { text: 'randomInt', link: '/reference/math/randomInt' }, + { text: 'range', link: '/reference/math/range' }, + { text: 'round', link: '/reference/math/round' }, + { text: 'sum', link: '/reference/math/sum' }, + { text: 'sumBy', link: '/reference/math/sumBy' }, ], }, { - text: "Object Utilities", + text: 'Object Utilities', items: [ - { text: "clone", link: "/reference/object/clone" }, - { text: "omit", link: "/reference/object/omit" }, - { text: "omitBy", link: "/reference/object/omitBy" }, - { text: "pick", link: "/reference/object/pick" }, - { text: "pickBy", link: "/reference/object/pickBy" }, - { text: "invert", link: "/reference/object/invert" }, + { text: 'clone', link: '/reference/object/clone' }, + { text: 'omit', link: '/reference/object/omit' }, + { text: 'omitBy', link: '/reference/object/omitBy' }, + { text: 'pick', link: '/reference/object/pick' }, + { text: 'pickBy', link: '/reference/object/pickBy' }, + { text: 'invert', link: '/reference/object/invert' }, ], }, { - text: "Predicates", + text: 'Predicates', items: [ - { text: "isNil", link: "/reference/predicate/isNil" }, - { text: "isNotNil", link: "/reference/predicate/isNotNil" }, - { text: "isNull", link: "/reference/predicate/isNull" }, - { text: "isUndefined", link: "/reference/predicate/isUndefined" }, + { text: 'isEqual', link: '/reference/predicate/isEqual' }, + { text: 'isNil', link: '/reference/predicate/isNil' }, + { text: 'isNotNil', link: '/reference/predicate/isNotNil' }, + { text: 'isNull', link: '/reference/predicate/isNull' }, + { text: 'isUndefined', link: '/reference/predicate/isUndefined' }, ], }, { - text: "Promise Utilities", - items: [{ text: "delay", link: "/reference/promise/delay" }], + text: 'Promise Utilities', + items: [{ text: 'delay', link: '/reference/promise/delay' }], }, { - text: "String Utilities", + text: 'String Utilities', items: [ - { text: "snakeCase", link: "/reference/string/snakeCase" }, - { text: "kebabCase", link: "/reference/string/kebabCase" }, - { text: "lowerCase", link: "/reference/string/lowerCase" }, - { text: "capitalize", link: "/reference/string/capitalize" }, + { text: 'snakeCase', link: '/reference/string/snakeCase' }, + { text: 'kebabCase', link: '/reference/string/kebabCase' }, + { text: 'lowerCase', link: '/reference/string/lowerCase' }, + { text: 'capitalize', link: '/reference/string/capitalize' }, ], }, ], diff --git a/docs/.vitepress/ko.mts b/docs/.vitepress/ko.mts index f17a9554..1067441c 100644 --- a/docs/.vitepress/ko.mts +++ b/docs/.vitepress/ko.mts @@ -1,9 +1,8 @@ -import { type DefaultTheme, defineConfig } from "vitepress"; +import { type DefaultTheme, defineConfig } from 'vitepress'; export const ko = defineConfig({ - lang: "ko", - description: - "빠른 성능, 작은 번들 사이즈를 가지는 현대적인 JavaScript 유틸리티 라이브러리", + lang: 'ko', + description: '빠른 성능, 작은 번들 사이즈를 가지는 현대적인 JavaScript 유틸리티 라이브러리', themeConfig: { nav: nav(), @@ -11,12 +10,12 @@ export const ko = defineConfig({ sidebar: sidebar(), editLink: { - pattern: "https://github.com/toss/es-toolkit/edit/main/docs/:path", - text: "GitHub에서 수정하기", + pattern: 'https://github.com/toss/es-toolkit/edit/main/docs/:path', + text: 'GitHub에서 수정하기', }, footer: { - message: "MIT 라이선스에 따라 배포됩니다.", + message: 'MIT 라이선스에 따라 배포됩니다.', copyright: `Copyright © ${new Date().getFullYear()} Viva Republica, Inc.`, }, }, @@ -24,156 +23,157 @@ export const ko = defineConfig({ function nav(): DefaultTheme.NavItem[] { return [ - { text: "홈", link: "/ko" }, - { text: "소개", link: "/ko/intro" }, - { text: "레퍼런스", link: "/ko/reference/array/chunk" }, + { text: '홈', link: '/ko' }, + { text: '소개', link: '/ko/intro' }, + { text: '레퍼런스', link: '/ko/reference/array/chunk' }, ]; } function sidebar(): DefaultTheme.Sidebar { return [ { - text: "가이드", + text: '가이드', items: [ - { text: "소개", link: "/ko/intro" }, - { text: "설치", link: "/ko/installation" }, - { text: "번들 사이즈", link: "/ko/bundle-size" }, - { text: "성능", link: "/ko/performance" }, - { text: "Lodash와 호환성", link: "/ko/compatibility" }, + { text: '소개', link: '/ko/intro' }, + { text: '설치', link: '/ko/installation' }, + { text: '번들 사이즈', link: '/ko/bundle-size' }, + { text: '성능', link: '/ko/performance' }, + { text: 'Lodash와 호환성', link: '/ko/compatibility' }, ], }, { - text: "레퍼런스", + text: '레퍼런스', items: [ { - text: "배열", + text: '배열', items: [ - { text: "chunk", link: "/ko/reference/array/chunk" }, - { text: "countBy", link: "/ko/reference/array/countBy" }, - { text: "compact", link: "/ko/reference/array/compact" }, - { text: "difference", link: "/ko/reference/array/difference" }, - { text: "differenceBy", link: "/ko/reference/array/differenceBy" }, + { text: 'chunk', link: '/ko/reference/array/chunk' }, + { text: 'countBy', link: '/ko/reference/array/countBy' }, + { text: 'compact', link: '/ko/reference/array/compact' }, + { text: 'difference', link: '/ko/reference/array/difference' }, + { text: 'differenceBy', link: '/ko/reference/array/differenceBy' }, { - text: "differenceWith", - link: "/ko/reference/array/differenceWith", + text: 'differenceWith', + link: '/ko/reference/array/differenceWith', }, - { text: "drop", link: "/ko/reference/array/drop" }, - { text: "dropWhile", link: "/ko/reference/array/dropWhile" }, - { text: "dropRight", link: "/ko/reference/array/dropRight" }, + { text: 'drop', link: '/ko/reference/array/drop' }, + { text: 'dropWhile', link: '/ko/reference/array/dropWhile' }, + { text: 'dropRight', link: '/ko/reference/array/dropRight' }, { - text: "dropRightWhile", - link: "/ko/reference/array/dropRightWhile", + text: 'dropRightWhile', + link: '/ko/reference/array/dropRightWhile', }, - { text: "fill", link: "/ko/reference/array/fill" }, - { text: "toFilled", link: "/ko/reference/array/toFilled" }, - { text: "flatten", link: "/ko/reference/array/flatten" }, - { text: "flattenDeep", link: "/ko/reference/array/flattenDeep" }, - { text: "forEachRight", link: "/reference/array/forEachRight" }, - { text: "groupBy", link: "/ko/reference/array/groupBy" }, - { text: "intersection", link: "/ko/reference/array/intersection" }, + { text: 'fill', link: '/ko/reference/array/fill' }, + { text: 'toFilled', link: '/ko/reference/array/toFilled' }, + { text: 'flatten', link: '/ko/reference/array/flatten' }, + { text: 'flattenDeep', link: '/ko/reference/array/flattenDeep' }, + { text: 'forEachRight', link: '/reference/array/forEachRight' }, + { text: 'groupBy', link: '/ko/reference/array/groupBy' }, + { text: 'intersection', link: '/ko/reference/array/intersection' }, { - text: "intersectionBy", - link: "/ko/reference/array/intersectionBy", + text: 'intersectionBy', + link: '/ko/reference/array/intersectionBy', }, { - text: "intersectionWith", - link: "/ko/reference/array/intersectionWith", + text: 'intersectionWith', + link: '/ko/reference/array/intersectionWith', }, - { text: "keyBy", link: "/ko/reference/array/keyBy" }, - { text: "minBy", link: "/ko/reference/array/minBy" }, - { text: "maxBy", link: "/ko/reference/array/maxBy" }, - { text: "orderBy", link: "/ko/reference/array/orderBy" }, - { text: "partition", link: "/ko/reference/array/partition" }, - { text: "sample", link: "/ko/reference/array/sample" }, - { text: "sampleSize", link: "/ko/reference/array/sampleSize" }, - { text: "shuffle", link: "/ko/reference/array/shuffle" }, - { text: "take", link: "/ko/reference/array/take" }, - { text: "takeWhile", link: "/ko/reference/array/takeWhile" }, - { text: "takeRight", link: "/ko/reference/array/takeRight" }, + { text: 'keyBy', link: '/ko/reference/array/keyBy' }, + { text: 'minBy', link: '/ko/reference/array/minBy' }, + { text: 'maxBy', link: '/ko/reference/array/maxBy' }, + { text: 'orderBy', link: '/ko/reference/array/orderBy' }, + { text: 'partition', link: '/ko/reference/array/partition' }, + { text: 'sample', link: '/ko/reference/array/sample' }, + { text: 'sampleSize', link: '/ko/reference/array/sampleSize' }, + { text: 'shuffle', link: '/ko/reference/array/shuffle' }, + { text: 'take', link: '/ko/reference/array/take' }, + { text: 'takeWhile', link: '/ko/reference/array/takeWhile' }, + { text: 'takeRight', link: '/ko/reference/array/takeRight' }, { - text: "takeRightWhile", - link: "/ko/reference/array/takeRightWhile", + text: 'takeRightWhile', + link: '/ko/reference/array/takeRightWhile', }, - { text: "union", link: "/ko/reference/array/union" }, - { text: "unionBy", link: "/ko/reference/array/unionBy" }, - { text: "unionWith", link: "/ko/reference/array/unionWith" }, - { text: "unzip", link: "/ko/reference/array/unzip" }, - { text: "unzipWith", link: "/ko/reference/array/unzipWith" }, - { text: "uniq", link: "/ko/reference/array/uniq" }, - { text: "uniqBy", link: "/ko/reference/array/uniqBy" }, - { text: "uniqWith", link: "/ko/reference/array/uniqWith" }, - { text: "without", link: "/ko/reference/array/without" }, - { text: "xor", link: "/ko/reference/array/xor" }, - { text: "xorBy", link: "/ko/reference/array/xorBy" }, - { text: "xorWith", link: "/ko/reference/array/xorWith" }, - { text: "zip", link: "/ko/reference/array/zip" }, - { text: "zipObject", link: "/ko/reference/array/zipObject" }, - { text: "zipWith", link: "/ko/reference/array/zipWith" }, - { text: "head", link: "/ko/reference/array/head" }, - { text: "tail", link: "/ko/reference/array/tail" }, - { text: "last", link: "/ko/reference/array/last" }, - { text: "initial", link: "/ko/reference/array/initial" }, + { text: 'union', link: '/ko/reference/array/union' }, + { text: 'unionBy', link: '/ko/reference/array/unionBy' }, + { text: 'unionWith', link: '/ko/reference/array/unionWith' }, + { text: 'unzip', link: '/ko/reference/array/unzip' }, + { text: 'unzipWith', link: '/ko/reference/array/unzipWith' }, + { text: 'uniq', link: '/ko/reference/array/uniq' }, + { text: 'uniqBy', link: '/ko/reference/array/uniqBy' }, + { text: 'uniqWith', link: '/ko/reference/array/uniqWith' }, + { text: 'without', link: '/ko/reference/array/without' }, + { text: 'xor', link: '/ko/reference/array/xor' }, + { text: 'xorBy', link: '/ko/reference/array/xorBy' }, + { text: 'xorWith', link: '/ko/reference/array/xorWith' }, + { text: 'zip', link: '/ko/reference/array/zip' }, + { text: 'zipObject', link: '/ko/reference/array/zipObject' }, + { text: 'zipWith', link: '/ko/reference/array/zipWith' }, + { text: 'head', link: '/ko/reference/array/head' }, + { text: 'tail', link: '/ko/reference/array/tail' }, + { text: 'last', link: '/ko/reference/array/last' }, + { text: 'initial', link: '/ko/reference/array/initial' }, ], }, { - text: "함수", + text: '함수', items: [ - { text: "debounce", link: "/ko/reference/function/debounce" }, - { text: "throttle", link: "/ko/reference/function/throttle" }, - { text: "negate", link: "/reference/function/negate" }, - { text: "once", link: "/ko/reference/function/once" }, - { text: "noop", link: "/ko/reference/function/noop" }, + { text: 'debounce', link: '/ko/reference/function/debounce' }, + { text: 'throttle', link: '/ko/reference/function/throttle' }, + { text: 'negate', link: '/reference/function/negate' }, + { text: 'once', link: '/ko/reference/function/once' }, + { text: 'noop', link: '/ko/reference/function/noop' }, ], }, { - text: "숫자", + text: '숫자', items: [ - { text: "clamp", link: "/ko/reference/math/clamp" }, - { text: "inRange", link: "/ko/reference/math/inRange" }, - { text: "mean", link: "/ko/reference/math/mean" }, - { text: "meanBy", link: "/ko/reference/math/meanBy" }, - { text: "random", link: "/ko/reference/math/random" }, - { text: "randomInt", link: "/ko/reference/math/randomInt" }, - { text: "round", link: "/ko/reference/math/round" }, - { text: "range", link: "/ko/reference/math/range" }, - { text: "sum", link: "/ko/reference/math/sum" }, - { text: "sumBy", link: "/ko/reference/math/sumBy" }, + { text: 'clamp', link: '/ko/reference/math/clamp' }, + { text: 'inRange', link: '/ko/reference/math/inRange' }, + { text: 'mean', link: '/ko/reference/math/mean' }, + { text: 'meanBy', link: '/ko/reference/math/meanBy' }, + { text: 'random', link: '/ko/reference/math/random' }, + { text: 'randomInt', link: '/ko/reference/math/randomInt' }, + { text: 'round', link: '/ko/reference/math/round' }, + { text: 'range', link: '/ko/reference/math/range' }, + { text: 'sum', link: '/ko/reference/math/sum' }, + { text: 'sumBy', link: '/ko/reference/math/sumBy' }, ], }, { - text: "객체", + text: '객체', items: [ - { text: "clone", link: "/ko/reference/object/clone" }, - { text: "omit", link: "/ko/reference/object/omit" }, - { text: "omitBy", link: "/ko/reference/object/omitBy" }, - { text: "pick", link: "/ko/reference/object/pick" }, - { text: "pickBy", link: "/ko/reference/object/pickBy" }, - { text: "invert", link: "/ko/reference/object/invert" }, + { text: 'clone', link: '/ko/reference/object/clone' }, + { text: 'omit', link: '/ko/reference/object/omit' }, + { text: 'omitBy', link: '/ko/reference/object/omitBy' }, + { text: 'pick', link: '/ko/reference/object/pick' }, + { text: 'pickBy', link: '/ko/reference/object/pickBy' }, + { text: 'invert', link: '/ko/reference/object/invert' }, ], }, { - text: "타입 가드", + text: '타입 가드', items: [ - { text: "isNil", link: "/ko/reference/predicate/isNil" }, - { text: "isNotNil", link: "/ko/reference/predicate/isNotNil" }, - { text: "isNull", link: "/ko/reference/predicate/isNull" }, + { text: 'isEqual', link: '/ko/reference/predicate/isEqual' }, + { text: 'isNil', link: '/ko/reference/predicate/isNil' }, + { text: 'isNotNil', link: '/ko/reference/predicate/isNotNil' }, + { text: 'isNull', link: '/ko/reference/predicate/isNull' }, { - text: "isUndefined", - link: "/ko/reference/predicate/isUndefined", + text: 'isUndefined', + link: '/ko/reference/predicate/isUndefined', }, ], }, { - text: "Promise", - items: [{ text: "delay", link: "/ko/reference/promise/delay" }], + text: 'Promise', + items: [{ text: 'delay', link: '/ko/reference/promise/delay' }], }, { - text: "문자열", + text: '문자열', items: [ - { text: "snakeCase", link: "/ko/reference/string/snakeCase" }, - { text: "kebabCase", link: "/ko/reference/string/kebabCase" }, - { text: "lowerCase", link: "/ko/reference/string/lowerCase" }, - { text: "capitalize", link: "/ko/reference/string/capitalize" }, + { text: 'snakeCase', link: '/ko/reference/string/snakeCase' }, + { text: 'kebabCase', link: '/ko/reference/string/kebabCase' }, + { text: 'lowerCase', link: '/ko/reference/string/lowerCase' }, + { text: 'capitalize', link: '/ko/reference/string/capitalize' }, ], }, ], @@ -181,27 +181,27 @@ function sidebar(): DefaultTheme.Sidebar { ]; } -export const search: DefaultTheme.LocalSearchOptions["locales"] = { +export const search: DefaultTheme.LocalSearchOptions['locales'] = { ko: { translations: { button: { - buttonText: "검색", - buttonAriaLabel: "검색", + buttonText: '검색', + buttonAriaLabel: '검색', }, modal: { - backButtonTitle: "뒤로가기", - displayDetails: "더보기", + backButtonTitle: '뒤로가기', + displayDetails: '더보기', footer: { - closeKeyAriaLabel: "닫기", - closeText: "닫기", - navigateDownKeyAriaLabel: "아래로", - navigateText: "이동", - navigateUpKeyAriaLabel: "위로", - selectKeyAriaLabel: "선택", - selectText: "선택", + closeKeyAriaLabel: '닫기', + closeText: '닫기', + navigateDownKeyAriaLabel: '아래로', + navigateText: '이동', + navigateUpKeyAriaLabel: '위로', + selectKeyAriaLabel: '선택', + selectText: '선택', }, - noResultsText: "검색 결과를 찾지 못했어요.", - resetButtonTitle: "모두 지우기", + noResultsText: '검색 결과를 찾지 못했어요.', + resetButtonTitle: '모두 지우기', }, }, }, diff --git a/docs/ko/reference/predicate/isEqual.md b/docs/ko/reference/predicate/isEqual.md new file mode 100644 index 00000000..6e54a0ab --- /dev/null +++ b/docs/ko/reference/predicate/isEqual.md @@ -0,0 +1,89 @@ +# isEqual + +`isEqual` 함수는 두 값이 동일한지 확인하며, `Date`, `RegExp`, 깊은 객체 비교도 지원해요. + +## Signature + +```typescript +function isEqual(a: unknown, b: unknown): boolean; +``` + +## Parameters + +- **`a`**: `unknown` - 비교할 첫 번째 값. +- **`b`**: `unknown` - 비교할 두 번째 값. + +## Returns + +- **`boolean`** - 두 값이 동일하면 `true`, 그렇지 않으면 `false`를 반환해요. + +## Examples + +### Example 1: 원시 타입 값 비교 + +```javascript +isEqual(1, 1); // true +isEqual('hello', 'hello'); // true +isEqual(true, true); // true +isEqual(1, 2); // false +isEqual('hello', 'world'); // false +isEqual(true, false); // false +``` + +### Example 2: 특수 경우 비교 + +```javascript +isEqual(NaN, NaN); // true +isEqual(+0, -0); // false +``` + +### Example 3: 날짜 객체 비교 + +```javascript +const date1 = new Date('2020-01-01'); +const date2 = new Date('2020-01-01'); +isEqual(date1, date2); // true + +const date3 = new Date('2021-01-01'); +isEqual(date1, date3); // false +``` + +### Example 4: 정규 표현식 객체 비교 + +```javascript +const regex1 = /hello/g; +const regex2 = /hello/g; +isEqual(regex1, regex2); // true + +const regex3 = /hello/i; +isEqual(regex1, regex3); // false +``` + +### Example 5: 객체 비교 + +```javascript +const obj1 = { a: 1, b: { c: 2 } }; +const obj2 = { a: 1, b: { c: 2 } }; +isEqual(obj1, obj2); // true + +const obj3 = { a: 1, b: { c: 3 } }; +isEqual(obj1, obj3); // false + +const obj4 = { a: 1, b: 2 }; +const obj5 = { a: 1, c: 2 }; +isEqual(obj4, obj5); // false +``` + +### Example 6: 배열 비교 + +```javascript +const arr1 = [1, 2, 3]; +const arr2 = [1, 2, 3]; +isEqual(arr1, arr2); // true + +const arr3 = [1, 2, 4]; +isEqual(arr1, arr3); // false + +const arr4 = [1, 2]; +isEqual(arr1, arr4); // false +``` diff --git a/docs/reference/predicate/isEqual.md b/docs/reference/predicate/isEqual.md index 9aed4690..625a98c8 100644 --- a/docs/reference/predicate/isEqual.md +++ b/docs/reference/predicate/isEqual.md @@ -3,19 +3,24 @@ The `isEqual` function checks if two values are equal, including support for `Date`, `RegExp`, and deep object comparison. ## Signature + ```typescript -export function isEqual(a: unknown, b: unknown): boolean; +function isEqual(a: unknown, b: unknown): boolean; ``` ## Parameters + - **`a`**: `unknown` - The first value to compare. - **`b`**: `unknown` - The second value to compare. ## Returns + - **`boolean`** - Returns `true` if the values are equal, otherwise `false`. ## Examples + ### Example 1: Comparing Primitive Values + ```javascript isEqual(1, 1); // true isEqual('hello', 'hello'); // true @@ -26,12 +31,14 @@ isEqual(true, false); // false ``` ### Example 2: Comparing Special Cases + ```javascript isEqual(NaN, NaN); // true isEqual(+0, -0); // false ``` ### Example 3: Comparing Date Objects + ```javascript const date1 = new Date('2020-01-01'); const date2 = new Date('2020-01-01'); @@ -42,6 +49,7 @@ isEqual(date1, date3); // false ``` ### Example 4: Comparing RegExp Objects + ```javascript const regex1 = /hello/g; const regex2 = /hello/g; @@ -52,6 +60,7 @@ isEqual(regex1, regex3); // false ``` ### Example 5: Comparing Objects + ```javascript const obj1 = { a: 1, b: { c: 2 } }; const obj2 = { a: 1, b: { c: 2 } }; @@ -66,6 +75,7 @@ isEqual(obj4, obj5); // false ``` ### Example 6: Comparing Arrays + ```javascript const arr1 = [1, 2, 3]; const arr2 = [1, 2, 3]; @@ -76,4 +86,4 @@ isEqual(arr1, arr3); // false const arr4 = [1, 2]; isEqual(arr1, arr4); // false -``` \ No newline at end of file +```