高效、轻量的前端工具库,提供丰富的 JavaScript 工具函数。
- 轻量级:零依赖,体积小,性能高
- 类型支持:使用 TypeScript 编写,提供完整类型定义
- 模块化:支持按需引入,减小打包体积
- 全面覆盖:包含数组、日期、DOM、格式化等多种常用工具函数
- 文档完善:详细的 API 文档和使用示例
npm install ft-base-tools
# 或者
yarn add ft-base-tools
# 或者
pnpm add ft-base-tools
import { arrayUnique, formatDate } from 'ft-base-tools';
// 数组去重
const arr = [1, 2, 2, 3, 3, 4];
const uniqueArr = arrayUnique(arr);
console.log(uniqueArr); // [1, 2, 3, 4]
// 日期格式化
const date = new Date();
const formattedDate = formatDate(date, 'YYYY-MM-DD');
console.log(formattedDate); // 例如:2025-01-01
查看完整文档:https://cgbin24.github.io/ft-base-tools/
npm install
npm run dev
npm run build
npm test
npm run docs:dev
npm run docs:build
npm run docs:preview
本项目使用 GitHub Actions 自动部署文档到 GitHub Pages。每当推送到 main
分支时,如果 docs
目录下的文件有变更,将自动触发构建和部署流程。
如果需要手动部署文档,可以按照以下步骤操作:
-
构建文档
npm run docs:build
-
将
docs/.vitepress/dist
目录下的文件部署到 GitHub Pages 或其他静态网站托管服务。
欢迎提交问题和贡献代码,请参阅贡献指南了解更多信息。