# comfunc

> 函数库

Latest version **1.0.5** (published 2018-06-26) · ISC license · 0 weekly downloads

## Install

```sh
npm install comfunc
pnpm add comfunc
yarn add comfunc
bun add comfunc
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2018-06-26 |
| First published | 2018-06-14 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 8.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | onion |
| Maintainers | onionrunning |

## Links

- npm: https://www.npmjs.com/package/comfunc
- Repository: git@gitlab2018:wangcong/comFunc
- npm.io page: https://npm.io/package/comfunc

## Recent versions

- 1.0.5 (latest) — 2018-06-26
- 1.0.4 — 2018-06-26
- 1.0.3 — 2018-06-26
- 1.0.2 — 2018-06-22
- 1.0.1 — 2018-06-14
- 1.0.0 — 2018-06-14

## README

# 这是一个公共的测试函数库

## 用法：

    npm install comfunc

    import _ from 'comfunc'

    既可以使用相应的包

## api 文档

### checkType 检测字符串类型

eg: _.checkType(str , type) ===> Boolearn

type

| str    | type             |
| ------ | ---------------- |
| ....   | email            | 邮箱
| ....   | idCard           | 身份证
| ....   | date_            | 2010-01-01
| ....   | date/            | 2010/10/10
| ....   | phone            | 手机号
| ....   | english          | 英文
| ....   | chinese          | 中文
| ....   | number           | 数字

### checkPwdStrength 检查密码强度

eg: _.checkPwdStrength(str) ===> Number(0,1,2,3,4)

0 小于 6位数
1 大于 6位数 数字或大小写或特殊符号 中 1 个
2 大于 6位数 数字或大小写或特殊符号 中 2 个
3 大于 6位数 数字或大小写或特殊符号 中 3 个
4 大于 6位数 数字或大小写或特殊符号 中 4 个

### digitUppercase  数字转换金额

eg: _.digitUppercase(1111) ===> 壹仟壹佰壹拾壹

### trim 去掉空格

eg: _.digitUppercase(str , type) ====> string

type 1-所有空格  2-前后空格  3-前空格 4-后空格

### isValid 判断是否是有用信息

eg: _.isValid(str) ====> Boolearn

### isJustify 判端对象，数组

数组
eg: _.isJustify.isArr()   ===> bool

对象
eg: _.isJustify.isObj()   ===> bool

### deepClone 深度克隆

eg: _.deepClone(obj)   ===> obj

### distinct 数组去重

eg: _.distinct(arr)   ===> new arr

### unique 数组子对象属性去重

eg: _.unique(arr)   ===> new arr

---

## download 下载文件

eg: _.download(url)

_.download('www.baidu.com')

## downExcel 下载文件

eg: _.downExcel(jsonData,str,name)

var jsonData = [{name:'wc',age:'12',sex:'男'},{name:'cw',age:'13',sex:'女'}],
str = '姓名,年龄,性别',
name = '下载的名称'

_.downExcel(jsonData,str,name)

---
_Source: https://npm.io/package/comfunc · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
