2.0.0 • Published 3 years ago
tool-func v2.0.0
functions
介绍
- 前端工具函数库(平时积累)
开发
clone项目
git clone https://github.com/kongkong99/tool-func
cd tool-func
npm install
包含的工具函数(代码路径src/)
- isIdentityCard 匹配身份证号
- isPhoneNumber 匹配手机号
- timeformat 格式化时间
使用
npm install -S tool-func
import { isPhoneNumber } from 'tool-func';
orimport tool from 'tool-func'
- .eslintrc 配置。 当引入 uc-fun eslint报错的时候配置以下两行
{ // ... rules: { // ... "import/no-unresolved": "off", "import/extensions": "off", } }
单测覆盖率
- functions = 100%
- branches > 90%
- lines > 90%
运行环境
- 所有支持es5的主流浏览器下,特殊情况如下
附录
- 单测:
- 测试框架
https://mochajs.org/
- 断言库
https://github.com/power-assert-js/power-assert
- 测试覆盖率
https://github.com/istanbuljs/nyc
- 模块调试
https://github.com/atian25/blog/issues/17
- Airbnb JavaScript 风格指南
https://github.com/lin-123/javascript
- 命名规则规范
https://cn.vuejs.org/v2/style-guide/index.html#优先级-B-的规则:强烈推荐-增强可读性
- sinon
https://sinonjs.org/
- 项目结构构建配置,参考了京东城市前端工具函数库
- 测试框架