Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/suyanhanx/hanutil

A repository of JavaScript common utils
https://github.com/suyanhanx/hanutil

javascript javascript-library util utils

Last synced: 23 days ago
JSON representation

A repository of JavaScript common utils

Awesome Lists containing this project

README

        

# hanutil

[![npm](https://img.shields.io/npm/v/hanutil.svg)](https://www.npmjs.com/package/hanutil)
![Build Status](https://img.shields.io/travis/suyanhanx/hanutil/master.svg)
[![Coverage Status](https://img.shields.io/coveralls/github/suyanhanx/hanutil/develop.svg)](https://coveralls.io/github/suyanhanx/hanutil?branch=develop)
![LICENSE MIT](https://img.shields.io/npm/l/hanutil.svg)
![LGTM](https://img.shields.io/lgtm/grade/javascript/g/suyanhanx/hanutil.svg)

## 前端公共方法库

为了节约花在项目编写时寻找常用方法的时间,开设此库,方便使用。

## 引入方式
可以完整引入整个包方便取用,也可以单独引入一个方法
``` javascript
// 只引入部分方法('hanutil/<方法名>')
const isArray = require('hanutil/isArray')
```

## APIs
具体函数签名可以参考[index.d.ts][index]

### Array

#### [arrayEqual:   判断两个数组是否相同][arrayEqual]
#### [convertClass:   将 String, Object, Array 转成 Array][convertClass]
#### [isArray:   判断是否是一个数组][isArray]

### Cookie

#### [getCookie:   获取cookie][getCookie]
#### [removeCookie:   移除cookie][removeCookie]
#### [setCookie:   设置cookie][setCookie]

### Function

#### [debounce:   函数防抖][debounce]
#### [throttle:   函数节流][throttle]

### Object

#### [deepAssign:   深度合并][deepAssign]
#### [deepClone:   深克隆][deepClone]
#### [getProperty:   由路径获取属性值][getProperty]
#### [isDef:   判断是否已定义][isDef]
#### [isEmptyObject:   判断是否是空对象][isEmptyObject]

### Validate

#### [isCarNumber:   车牌号验证][isCarNumber]
#### [isEmail:   电子邮箱email验证][isEmail]
#### [isIdCard:   身份证号码验证][isIdCard]
#### [isPhoneNum:   手机号验证][isPhoneNum]
#### [isTaxNumber:   税号验证][isTaxNumber]

[index]:https://github.com/suyanhanx/hanutil/blob/master/index.d.ts

[arrayEqual]:https://github.com/suyanhanx/hanutil/blob/master/src/array/arrayEqual.js
[convertClass]:https://github.com/suyanhanx/hanutil/blob/master/src/array/convertClass.js
[isArray]:https://github.com/suyanhanx/hanutil/blob/master/src/array/isArray.js

[getCookie]:https://github.com/suyanhanx/hanutil/blob/master/src/cookie/getCookie.js
[removeCookie]:https://github.com/suyanhanx/hanutil/blob/master/src/cookie/removeCookie.js
[setCookie]:https://github.com/suyanhanx/hanutil/blob/master/src/cookie/setCookie.js

[debounce]:https://github.com/suyanhanx/hanutil/blob/master/src/function/debounce.js
[throttle]:https://github.com/suyanhanx/hanutil/blob/master/src/function/throttle.js

[deepAssign]:https://github.com/suyanhanx/hanutil/blob/master/src/object/deepAssign.js
[deepClone]:https://github.com/suyanhanx/hanutil/blob/master/src/object/deepClone.js
[getProperty]:https://github.com/suyanhanx/hanutil/blob/master/src/object/getProperty.js
[isDef]:https://github.com/suyanhanx/hanutil/blob/master/src/object/isDef.js
[isEmptyObject]:https://github.com/suyanhanx/hanutil/blob/master/src/object/isEmptyObject.js

[isCarNumber]:https://github.com/suyanhanx/hanutil/blob/master/src/validate/isCarNumber.js
[isEmail]:https://github.com/suyanhanx/hanutil/blob/master/src/validate/isEmail.js
[isIdCard]:https://github.com/suyanhanx/hanutil/blob/master/src/validate/isIdCard.js
[isPhoneNum]:https://github.com/suyanhanx/hanutil/blob/master/src/validate/isPhoneNum.js
[isTaxNumber]:https://github.com/suyanhanx/hanutil/blob/master/src/validate/isTaxNumber.js