2024-07-16 06:31:56 +03:00
|
|
|
import { type DefaultTheme, defineConfig } from 'vitepress';
|
2024-07-12 04:08:55 +03:00
|
|
|
|
|
|
|
export const zh_hans = defineConfig({
|
2024-07-16 06:31:56 +03:00
|
|
|
lang: 'zh_hans',
|
|
|
|
description: '一款先进的高性能 JavaScript 实用库,具有小巧的包体积和强大的类型注解。',
|
2024-07-12 04:08:55 +03:00
|
|
|
|
|
|
|
themeConfig: {
|
|
|
|
nav: nav(),
|
|
|
|
|
|
|
|
sidebar: sidebar(),
|
|
|
|
|
|
|
|
editLink: {
|
2024-07-16 06:31:56 +03:00
|
|
|
pattern: 'https://github.com/toss/es-toolkit/edit/main/docs/:path',
|
|
|
|
text: '在 GitHub 上编辑此页面',
|
2024-07-12 04:08:55 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
footer: {
|
2024-07-16 06:31:56 +03:00
|
|
|
message: '采用 MIT 许可证发布。',
|
2024-07-12 04:08:55 +03:00
|
|
|
copyright: `Copyright © ${new Date().getFullYear()} Viva Republica, Inc.`,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
function nav(): DefaultTheme.NavItem[] {
|
|
|
|
return [
|
2024-07-16 06:31:56 +03:00
|
|
|
{ text: '主页', link: '/zh_hans/' },
|
|
|
|
{ text: '简介', link: '/zh_hans/intro' },
|
|
|
|
{ text: '参考', link: '/zh_hans/reference/array/chunk' },
|
2024-07-12 04:08:55 +03:00
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
function sidebar(): DefaultTheme.Sidebar {
|
|
|
|
return [
|
|
|
|
{
|
2024-07-16 06:31:56 +03:00
|
|
|
text: '指南',
|
2024-07-12 04:08:55 +03:00
|
|
|
items: [
|
2024-07-16 06:31:56 +03:00
|
|
|
{ text: '简介', link: '/zh_hans/intro' },
|
2024-07-21 12:01:25 +03:00
|
|
|
{ text: '安装和使用', link: '/zh_hans/usage' },
|
2024-07-16 06:31:56 +03:00
|
|
|
{ text: '包体积影响', link: '/zh_hans/bundle-size' },
|
|
|
|
{ text: '性能', link: '/zh_hans/performance' },
|
|
|
|
{ text: '与 Lodash 兼容性', link: '/zh_hans/compatibility' },
|
2024-07-12 04:08:55 +03:00
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
2024-07-16 06:31:56 +03:00
|
|
|
text: '参考',
|
2024-07-12 04:08:55 +03:00
|
|
|
items: [
|
|
|
|
{
|
2024-07-16 06:31:56 +03:00
|
|
|
text: '数组工具',
|
2024-07-12 04:08:55 +03:00
|
|
|
items: [
|
2024-07-16 06:31:56 +03:00
|
|
|
{ text: 'chunk', link: '/zh_hans/reference/array/chunk' },
|
2024-07-19 03:44:00 +03:00
|
|
|
{ text: 'concat (兼容性)', link: '/zh_hans/reference/compat/array/concat' },
|
2024-07-16 06:31:56 +03:00
|
|
|
{ text: 'countBy', link: '/zh_hans/reference/array/countBy' },
|
|
|
|
{ text: 'compact', link: '/zh_hans/reference/array/compact' },
|
|
|
|
{ text: 'difference', link: '/zh_hans/reference/array/difference' },
|
|
|
|
{ text: 'differenceBy', link: '/zh_hans/reference/array/differenceBy' },
|
|
|
|
{ text: 'differenceWith', link: '/zh_hans/reference/array/differenceWith' },
|
|
|
|
{ text: 'drop', link: '/zh_hans/reference/array/drop' },
|
|
|
|
{ text: 'dropWhile', link: '/zh_hans/reference/array/dropWhile' },
|
|
|
|
{ text: 'dropRight', link: '/zh_hans/reference/array/dropRight' },
|
|
|
|
{ text: 'dropRightWhile', link: '/zh_hans/reference/array/dropRightWhile' },
|
|
|
|
{ text: 'fill', link: '/zh_hans/reference/array/fill' },
|
|
|
|
{ text: 'toFilled', link: '/zh_hans/reference/array/toFilled' },
|
2024-08-11 09:05:04 +03:00
|
|
|
{ text: 'find (兼容性)', link: '/zh_hans/reference/compat/array/find' },
|
2024-08-11 15:10:18 +03:00
|
|
|
{ text: 'findIndex (兼容性)', link: '/zh_hans/reference/compat/array/findIndex' },
|
2024-07-16 06:31:56 +03:00
|
|
|
{ text: 'flatMap', link: '/zh_hans/reference/array/flatMap' },
|
|
|
|
{ text: 'flatten', link: '/zh_hans/reference/array/flatten' },
|
|
|
|
{ text: 'flattenDeep', link: '/zh_hans/reference/array/flattenDeep' },
|
|
|
|
{ text: 'forEachRight', link: '/zh_hans/reference/array/forEachRight' },
|
|
|
|
{ text: 'groupBy', link: '/zh_hans/reference/array/groupBy' },
|
2024-08-11 15:20:11 +03:00
|
|
|
{ text: 'indexOf (兼容性)', link: '/zh_hans/reference/compat/array/indexOf' },
|
2024-07-16 06:31:56 +03:00
|
|
|
{ text: 'intersection', link: '/zh_hans/reference/array/intersection' },
|
|
|
|
{ text: 'intersectionBy', link: '/zh_hans/reference/array/intersectionBy' },
|
|
|
|
{ text: 'intersectionWith', link: '/zh_hans/reference/array/intersectionWith' },
|
2024-08-10 04:03:41 +03:00
|
|
|
{ text: 'isSubset', link: '/zh_hans/reference/array/isSubset' },
|
2024-07-16 06:31:56 +03:00
|
|
|
{ text: 'keyBy', link: '/zh_hans/reference/array/keyBy' },
|
|
|
|
{ text: 'minBy', link: '/zh_hans/reference/array/minBy' },
|
|
|
|
{ text: 'maxBy', link: '/zh_hans/reference/array/maxBy' },
|
2024-07-18 18:00:57 +03:00
|
|
|
{ text: 'min (兼容性)', link: '/zh_hans/reference/compat/array/min' },
|
|
|
|
{ text: 'max (兼容性)', link: '/zh_hans/reference/compat/array/max' },
|
2024-07-16 06:31:56 +03:00
|
|
|
{ text: 'orderBy', link: '/zh_hans/reference/array/orderBy' },
|
|
|
|
{ text: 'partition', link: '/zh_hans/reference/array/partition' },
|
|
|
|
{ text: 'sample', link: '/zh_hans/reference/array/sample' },
|
|
|
|
{ text: 'sampleSize', link: '/zh_hans/reference/array/sampleSize' },
|
|
|
|
{ text: 'shuffle', link: '/zh_hans/reference/array/shuffle' },
|
2024-08-09 04:01:46 +03:00
|
|
|
{ text: 'size (兼容性)', link: '/zh_hans/reference/compat/array/size' },
|
2024-08-15 05:33:40 +03:00
|
|
|
{ text: 'sortBy', link: '/zh_hans/reference/array/sortBy' },
|
2024-07-16 06:31:56 +03:00
|
|
|
{ text: 'take', link: '/zh_hans/reference/array/take' },
|
|
|
|
{ text: 'takeWhile', link: '/zh_hans/reference/array/takeWhile' },
|
|
|
|
{ text: 'takeRight', link: '/zh_hans/reference/array/takeRight' },
|
|
|
|
{ text: 'takeRightWhile', link: '/zh_hans/reference/array/takeRightWhile' },
|
|
|
|
{ text: 'union', link: '/zh_hans/reference/array/union' },
|
|
|
|
{ text: 'unionBy', link: '/zh_hans/reference/array/unionBy' },
|
|
|
|
{ text: 'unionWith', link: '/zh_hans/reference/array/unionWith' },
|
|
|
|
{ text: 'uniq', link: '/zh_hans/reference/array/uniq' },
|
|
|
|
{ text: 'uniqBy', link: '/zh_hans/reference/array/uniqBy' },
|
|
|
|
{ text: 'uniqWith', link: '/zh_hans/reference/array/uniqWith' },
|
|
|
|
{ text: 'unzip', link: '/zh_hans/reference/array/unzip' },
|
|
|
|
{ text: 'unzipWith', link: '/zh_hans/reference/array/unzipWith' },
|
|
|
|
{ text: 'without', link: '/zh_hans/reference/array/without' },
|
|
|
|
{ text: 'xor', link: '/zh_hans/reference/array/xor' },
|
|
|
|
{ text: 'xorBy', link: '/zh_hans/reference/array/xorBy' },
|
|
|
|
{ text: 'xorWith', link: '/zh_hans/reference/array/xorWith' },
|
|
|
|
{ text: 'zip', link: '/zh_hans/reference/array/zip' },
|
|
|
|
{ text: 'zipObject', link: '/zh_hans/reference/array/zipObject' },
|
2024-07-18 14:28:07 +03:00
|
|
|
{ text: 'zipObjectDeep (兼容性)', link: '/zh_hans/reference/compat/array/zipObjectDeep' },
|
2024-07-16 06:31:56 +03:00
|
|
|
{ text: 'zipWith', link: '/zh_hans/reference/array/zipWith' },
|
|
|
|
{ text: 'head', link: '/zh_hans/reference/array/head' },
|
|
|
|
{ text: 'tail', link: '/zh_hans/reference/array/tail' },
|
|
|
|
{ text: 'last', link: '/zh_hans/reference/array/last' },
|
|
|
|
{ text: 'initial', link: '/zh_hans/reference/array/initial' },
|
2024-07-12 04:08:55 +03:00
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
2024-07-16 06:31:56 +03:00
|
|
|
text: '函数工具',
|
2024-07-12 04:08:55 +03:00
|
|
|
items: [
|
2024-07-29 18:02:49 +03:00
|
|
|
{ text: 'before', link: '/zh_hans/reference/function/before' },
|
2024-07-21 15:29:14 +03:00
|
|
|
{ text: 'after', link: '/zh_hans/reference/function/after' },
|
2024-07-16 06:31:56 +03:00
|
|
|
{ text: 'debounce', link: '/zh_hans/reference/function/debounce' },
|
|
|
|
{ text: 'throttle', link: '/zh_hans/reference/function/throttle' },
|
|
|
|
{ text: 'negate', link: '/zh_hans/reference/function/negate' },
|
|
|
|
{ text: 'once', link: '/zh_hans/reference/function/once' },
|
|
|
|
{ text: 'noop', link: '/zh_hans/reference/function/noop' },
|
2024-08-04 17:23:00 +03:00
|
|
|
{ text: 'ary', link: '/zh_hans/reference/function/ary' },
|
|
|
|
{ text: 'unary', link: '/zh_hans/reference/function/unary' },
|
2024-08-10 04:03:41 +03:00
|
|
|
{ text: 'bind (兼容性)', link: '/zh_hans/reference/compat/function/bind' },
|
2024-08-11 04:53:02 +03:00
|
|
|
{ text: 'partial', link: '/zh_hans/reference/function/partial' },
|
|
|
|
{ text: 'partialRight', link: '/zh_hans/reference/function/partialRight' },
|
2024-07-12 04:08:55 +03:00
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
2024-07-16 06:31:56 +03:00
|
|
|
text: '数学工具',
|
2024-07-12 04:08:55 +03:00
|
|
|
items: [
|
2024-07-16 06:31:56 +03:00
|
|
|
{ text: 'clamp', link: '/zh_hans/reference/math/clamp' },
|
|
|
|
{ text: 'inRange', link: '/zh_hans/reference/math/inRange' },
|
|
|
|
{ text: 'mean', link: '/zh_hans/reference/math/mean' },
|
|
|
|
{ text: 'meanBy', link: '/zh_hans/reference/math/meanBy' },
|
|
|
|
{ text: 'random', link: '/zh_hans/reference/math/random' },
|
|
|
|
{ text: 'randomInt', link: '/zh_hans/reference/math/randomInt' },
|
|
|
|
{ text: 'range', link: '/zh_hans/reference/math/range' },
|
|
|
|
{ text: 'round', link: '/zh_hans/reference/math/round' },
|
|
|
|
{ text: 'sum', link: '/zh_hans/reference/math/sum' },
|
|
|
|
{ text: 'sumBy', link: '/zh_hans/reference/math/sumBy' },
|
2024-07-12 04:08:55 +03:00
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
2024-07-16 06:31:56 +03:00
|
|
|
text: '对象工具',
|
2024-07-12 04:08:55 +03:00
|
|
|
items: [
|
2024-07-16 06:31:56 +03:00
|
|
|
{ text: 'clone', link: '/zh_hans/reference/object/clone' },
|
2024-07-24 18:41:47 +03:00
|
|
|
{ text: 'cloneDeep', link: '/zh_hans/reference/object/cloneDeep' },
|
2024-07-18 14:28:07 +03:00
|
|
|
{ text: 'invert', link: '/zh_hans/reference/object/invert' },
|
2024-07-19 13:09:29 +03:00
|
|
|
{ text: 'flattenObject', link: '/zh_hans/reference/object/flattenObject' },
|
2024-07-25 05:43:15 +03:00
|
|
|
{ text: 'mapKeys', link: '/zh_hans/reference/object/mapKeys' },
|
|
|
|
{ text: 'mapValues', link: '/zh_hans/reference/object/mapValues' },
|
2024-08-10 09:38:00 +03:00
|
|
|
{ text: 'merge', link: '/zh_hans/reference/object/merge' },
|
2024-08-10 10:24:51 +03:00
|
|
|
{ text: 'mergeWith', link: '/zh_hans/reference/object/mergeWith' },
|
2024-08-10 09:38:00 +03:00
|
|
|
{ text: 'toMerged', link: '/zh_hans/reference/object/toMerged' },
|
2024-07-16 06:31:56 +03:00
|
|
|
{ text: 'omit', link: '/zh_hans/reference/object/omit' },
|
|
|
|
{ text: 'omitBy', link: '/zh_hans/reference/object/omitBy' },
|
|
|
|
{ text: 'pick', link: '/zh_hans/reference/object/pick' },
|
|
|
|
{ text: 'pickBy', link: '/zh_hans/reference/object/pickBy' },
|
2024-07-18 16:59:11 +03:00
|
|
|
{ text: 'get (兼容性)', link: '/zh_hans/reference/compat/object/get' },
|
|
|
|
{ text: 'set (兼容性)', link: '/zh_hans/reference/compat/object/set' },
|
2024-08-11 06:56:15 +03:00
|
|
|
{ text: 'has (兼容性)', link: '/zh_hans/reference/compat/object/has' },
|
2024-07-25 06:04:32 +03:00
|
|
|
{ text: 'property (兼容性)', link: '/zh_hans/reference/compat/object/property' },
|
2024-07-12 04:08:55 +03:00
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
2024-07-16 06:31:56 +03:00
|
|
|
text: '谓词',
|
2024-07-12 04:08:55 +03:00
|
|
|
items: [
|
2024-08-09 04:28:11 +03:00
|
|
|
{ text: 'isArguments (兼容性)', link: '/zh_hans/reference/compat/predicate/isArguments' },
|
2024-07-21 04:38:14 +03:00
|
|
|
{ text: 'isArray (兼容性)', link: '/zh_hans/reference/compat/predicate/isArray' },
|
2024-08-09 04:16:37 +03:00
|
|
|
{ text: 'isArrayLike (兼容性)', link: '/zh_hans/reference/predicate/isArrayLike' },
|
2024-07-16 06:31:56 +03:00
|
|
|
{ text: 'isEqual', link: '/zh_hans/reference/predicate/isEqual' },
|
2024-07-21 04:55:36 +03:00
|
|
|
{ text: 'isFunction', link: '/zh_hans/reference/predicate/isFunction' },
|
2024-07-21 16:56:28 +03:00
|
|
|
{ text: 'isLength', link: '/zh_hans/reference/predicate/isLength' },
|
2024-07-19 13:00:44 +03:00
|
|
|
{ text: 'isPlainObject', link: '/zh_hans/reference/predicate/isPlainObject' },
|
2024-07-21 17:08:02 +03:00
|
|
|
{ text: 'isPrimitive', link: '/zh_hans/reference/predicate/isPrimitive' },
|
2024-08-15 05:09:23 +03:00
|
|
|
{ text: 'isString', link: '/zh_hans/reference/predicate/isString' },
|
2024-08-10 04:16:18 +03:00
|
|
|
{ text: 'isSymbol', link: '/zh_hans/reference/predicate/isSymbol' },
|
2024-07-25 05:36:14 +03:00
|
|
|
{ text: 'isMatch (兼容性)', link: '/zh_hans/reference/compat/predicate/isMatch' },
|
|
|
|
{ text: 'matches (兼容性)', link: '/zh_hans/reference/compat/predicate/matches' },
|
2024-08-11 08:09:13 +03:00
|
|
|
{ text: 'matchesProperty (兼容性)', link: '/zh_hans/reference/compat/predicate/matchesProperty' },
|
2024-07-16 06:31:56 +03:00
|
|
|
{ text: 'isNil', link: '/zh_hans/reference/predicate/isNil' },
|
|
|
|
{ text: 'isNotNil', link: '/zh_hans/reference/predicate/isNotNil' },
|
|
|
|
{ text: 'isNull', link: '/zh_hans/reference/predicate/isNull' },
|
2024-08-09 04:28:11 +03:00
|
|
|
{ text: 'isObjectLike (兼容性)', link: '/zh_hans/reference/compat/predicate/isObjectLike' },
|
2024-07-21 16:56:28 +03:00
|
|
|
{ text: 'isTypedArray', link: '/zh_hans/reference/predicate/isTypedArray' },
|
2024-07-16 06:31:56 +03:00
|
|
|
{ text: 'isUndefined', link: '/zh_hans/reference/predicate/isUndefined' },
|
2024-07-12 04:08:55 +03:00
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
2024-07-16 06:31:56 +03:00
|
|
|
text: 'Promise 工具',
|
2024-07-18 18:53:17 +03:00
|
|
|
items: [
|
|
|
|
{ text: 'delay', link: '/zh_hans/reference/promise/delay' },
|
|
|
|
{ text: 'timeout', link: '/zh_hans/reference/promise/timeout' },
|
|
|
|
{ text: 'withTimeout', link: '/zh_hans/reference/promise/withTimeout' },
|
|
|
|
],
|
2024-07-12 04:08:55 +03:00
|
|
|
},
|
|
|
|
{
|
2024-07-16 06:31:56 +03:00
|
|
|
text: '字符串工具',
|
|
|
|
items: [
|
|
|
|
{ text: 'camelCase', link: '/zh_hans/reference/string/camelCase' },
|
|
|
|
{ text: 'snakeCase', link: '/zh_hans/reference/string/snakeCase' },
|
|
|
|
{ text: 'kebabCase', link: '/zh_hans/reference/string/kebabCase' },
|
|
|
|
{ text: 'lowerCase', link: '/zh_hans/reference/string/lowerCase' },
|
2024-08-10 04:26:23 +03:00
|
|
|
{ text: 'startCase', link: '/zh_hans/reference/string/startCase' },
|
|
|
|
{ text: 'pascalCase', link: '/zh_hans/reference/string/pascalCase' },
|
2024-07-16 06:31:56 +03:00
|
|
|
{ text: 'capitalize', link: '/zh_hans/reference/string/capitalize' },
|
2024-07-21 04:34:43 +03:00
|
|
|
{ text: 'startsWith (兼容性)', link: '/zh_hans/reference/compat/string/startsWith' },
|
|
|
|
{ text: 'endsWith (兼容性)', link: '/zh_hans/reference/compat/string/endsWith' },
|
2024-08-09 04:28:11 +03:00
|
|
|
{ text: 'padStart (兼容性)', link: '/zh_hans/reference/compat/string/padStart' },
|
2024-07-16 06:31:56 +03:00
|
|
|
],
|
2024-07-20 05:21:19 +03:00
|
|
|
},
|
2024-08-11 15:38:32 +03:00
|
|
|
{
|
|
|
|
text: '错误',
|
|
|
|
items: [
|
|
|
|
{ text: 'AbortError', link: '/zh_hans/reference/error/AbortError' },
|
|
|
|
{ text: 'TimeoutError', link: '/zh_hans/reference/error/TimeoutError' },
|
|
|
|
],
|
|
|
|
},
|
2024-07-12 04:08:55 +03:00
|
|
|
],
|
|
|
|
},
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
2024-07-16 06:31:56 +03:00
|
|
|
export const search: DefaultTheme.LocalSearchOptions['locales'] = {
|
2024-07-12 04:08:55 +03:00
|
|
|
zh_hans: {
|
|
|
|
translations: {
|
|
|
|
button: {
|
2024-07-16 06:31:56 +03:00
|
|
|
buttonText: '搜索',
|
|
|
|
buttonAriaLabel: '搜索',
|
2024-07-12 04:08:55 +03:00
|
|
|
},
|
|
|
|
modal: {
|
2024-07-16 06:31:56 +03:00
|
|
|
backButtonTitle: '返回',
|
|
|
|
displayDetails: '显示详情',
|
2024-07-12 04:08:55 +03:00
|
|
|
footer: {
|
2024-07-16 06:31:56 +03:00
|
|
|
closeKeyAriaLabel: '关闭',
|
|
|
|
closeText: '关闭',
|
|
|
|
navigateDownKeyAriaLabel: '向下导航',
|
|
|
|
navigateText: '导航',
|
|
|
|
navigateUpKeyAriaLabel: '向上导航',
|
|
|
|
selectKeyAriaLabel: '选择',
|
|
|
|
selectText: '选择',
|
2024-07-12 04:08:55 +03:00
|
|
|
},
|
2024-07-16 06:31:56 +03:00
|
|
|
noResultsText: '未找到搜索结果。',
|
|
|
|
resetButtonTitle: '重置',
|
2024-07-12 04:08:55 +03:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|