Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/suyanhanx/hanutil
- Owner: suyanhanx
- License: mit
- Created: 2018-09-24T13:20:57.000Z (about 6 years ago)
- Default Branch: develop
- Last Pushed: 2023-07-11T20:55:02.000Z (over 1 year ago)
- Last Synced: 2024-10-04T15:14:18.096Z (about 1 month ago)
- Topics: javascript, javascript-library, util, utils
- Language: JavaScript
- Homepage: https://suyan.moe/hanutil
- Size: 336 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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