# 项目背景
- 集成多个常用的JavaScript代码片段,提高生产力。
- 将代码片段用NPM的形式引入,提高代码的维护性。
# 项目地址
Github: https://github.com/czero1995/util-snippets
NPM: https://www.npmjs.com/package/util-snippets
# 技术背景
- 基于 TypeScript 强类型编写代码。
- 使用 Jest 做单元测试。
- 使用 VuePress 做的技术文档
# 项目安装
npm install util-snippets
# 项目使用
import { xxx } from 'util-snippets'
# 项目本地测试
git clone https://github.com/czero1995/util-snippets.git
cd util-snippets
npm install // 安装项目依赖
npm run tsc:w // 将TypeScript实时转换为JavaScriot,方便调试
npm link // 相当于npm install util-snippets
在其他项目直接使用 import { xxx } from 'util-snippets'
# 项目发布
npm login
publish
# 参考文章
(需要梯子)
127 Helpful JavaScript Snippets You Can Learn in 30 Seconds or Less — Part 1 of 6