wjs-utils
v1.0.10
Published
通用工具函数
Downloads
6
Readme
wjs-utils⚡
安装 💡
yarn add wjs-utils
or
npm install wjs-utils
使用 🌲
import utils from "wjs-utils";
utils.isEmail("[email protected]")
or
import { isEmail } from "wjs-utils";
isEmail("[email protected]")
or
const utils = require("wjs-utils");
持续更新中 ~ 🚀🚀🚀
isEmail(email) ⇒ boolean
判断是否为邮箱
| Param | Type | Description | | --- | --- | --- | | email | string | email |
Example
isEmail("[email protected]") // true
Example
isEmail("aaqq.com") // false
isPhone(phone) ⇒ boolean
判断是否为手机号码(最宽松)
| Param | Type | | --- | --- | | phone | number | string |
Example
isPhone(13541231213) //true
Example
isPhone(123) //false
isIdCard(idcard) ⇒ boolean
判断是否为身份证号码(支持一代/二代)
| Param | Type | | --- | --- | | idcard | string | number |
Example
isIdCard(510902198910124421) // true
Example
isIdCard(123) // false
sleep(time) ⇒ Promise
延迟多少秒后继续执行
| Param | Type | | --- | --- | | time | number |
Example
sleep(1)
formatUrl(url) ⇒ Object
解析url参数为object
| Param | Type | | --- | --- | | url | string |
Example
formatUrl("http://www.baidu.com?a=1&b=aaa") // {a:'1',b:'aaa'}
Example
formatUrl("http://www.baidu.com?a=1&a=2&b=3&b=4") // { a: ["1", "2"], b: ["3", "4"]}
saveBlobFile(blob, param1)
保存文件
| Param | Type | | --- | --- | | blob | * | | param1 | * |
Author
wjs email:[email protected]