common-function-utils
Version:
web和node开发中常用的函数工具。
81 lines (64 loc) • 1.92 kB
Markdown
# common-function-utils
### 在业务开发中常用的前端工具函数。
### 安装及用法
1、NPM
```bash
npm install common-function-utils -S
```
```bash
yarn add common-function-utils -S
```
```js
// ES module:
import { setCookieItem, getCookieItem } from "common-function-utils"
setCookieItem("test1", "Unicode test: \u6bd4\u8bfa");
getCookieItem('test1'); // Unicode test: 比诺
// CommonJs:
var commonUtils = require("common-function-utils");
commonUtils.languageInfo(); // { "language": "zh-cn", "languages": ["zh-CN" ] }
```
2、直接用 \<script> 引入,加载后会在window上会挂载 commonUtils,具体URL请查看 <a href="https://github.com/robint-liu/common-function-utils/blob/main/cdn-files.md">cdn files</a>
```html
<script src="file url"></script>
<script>
const clientName = commonUtils.clientName();
console.log(clientName); // SM-G900P
</script>
```
### 文档
<h4><a href="https://robint-liu.github.io/common-function-utils">API document</a></h4>
<!-- ### 支持
todo statistics -->
### 调试及构建
```bash
# 自动生成API文档和脚本
npm start
# 测试
npm run test
# 代码检查
npm run fix
# 打包
npm run build
```
### 项目发布
```bash
☞ npm login
☞ npm publish
```
### 补充工具
* https://github.com/lodash/lodash
* https://github.com/iamkun/dayjs
* https://github.com/jashkenas/underscore
* https://github.com/jashkenas/backbone/
* https://github.com/shadowOfCode/bee.js
* https://github.com/tnfe/bbo
* https://github.com/proYang/outils
* https://github.com/liriliri/licia
* https://www.jb51.net/article/195385.htm
* https://www.cnblogs.com/aidixie/p/11401382.html
* https://www.sohu.com/a/397823902_744986
* ······
<h2>注释</h2>
<article>
在其他可支持项目中引入该包,并在其项目下执行"npm link common-function-utils",然后正常使用即可。
</article>