# front-utils **Repository Path**: maple-season/front-utils ## Basic Information - **Project Name**: front-utils - **Description**: 前端工具库收集、编写 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-06-12 - **Last Updated**: 2025-06-16 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # front-utils ## 简介 前端工具库,提供常用的前端开发工具函数,包括数组、字符串、日期、数字、对象、函数和DOM操作等方面的实用函数。 ## 技术栈 - Vite - 构建工具 - Vitest - 测试框架 - ESLint - 代码检查 - Prettier - 代码格式化 ## 安装 ```bash # 使用npm npm install # 使用pnpm pnpm install # 使用yarn yarn ``` ## 开发 ```bash # 启动开发服务器 npm run dev # 或 pnpm dev # 或 yarn dev ``` ## 构建 ```bash # 构建生产版本 npm run build # 或 pnpm build # 或 yarn build ``` ## 测试 ```bash # 运行测试 npm run test # 或 pnpm test # 或 yarn test # 查看测试覆盖率 npm run test:coverage # 或 pnpm test:coverage # 或 yarn test:coverage # 使用UI界面查看测试 npm run test:ui # 或 pnpm test:ui # 或 yarn test:ui ``` ## 代码规范 ```bash # 代码检查 npm run lint # 或 pnpm lint # 或 yarn lint # 自动修复代码问题 npm run lint:fix # 或 pnpm lint:fix # 或 yarn lint:fix # 格式化代码 npm run format # 或 pnpm format # 或 yarn format ``` ## 模块列表 - `array` - 数组操作工具 - `string` - 字符串处理工具 - `date` - 日期处理工具 - `number` - 数字处理工具 - `object` - 对象操作工具 - `function` - 函数工具 - `dom` - DOM操作工具 ## 使用示例 ```javascript // 导入特定工具 import { arrayUtils, stringUtils } from 'front-utils'; // 使用数组去重工具 const arr = [1, 2, 2, 3, 3, 4]; const uniqueArr = arrayUtils.unique(arr); console.log(uniqueArr); // [1, 2, 3, 4] // 使用字符串首字母大写工具 const str = 'hello world'; const capitalizedStr = stringUtils.capitalize(str); console.log(capitalizedStr); // 'Hello world' // 使用默认导出 import frontUtils from 'front-utils'; const formattedDate = frontUtils.date.format(new Date(), 'YYYY-MM-DD'); console.log(formattedDate); // '2023-05-20' ``` ## 参与贡献 1. Fork 本仓库 2. 新建 feature_xxx 分支 3. 提交代码 4. 新建 Pull Request #### 特技 1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md 2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) 3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) 6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)