1.0.10 • Published 2 years ago

wjs-utils v1.0.10

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

wjs-utils⚡

npm version

安装 💡

yarn add wjs-utils

or

npm install wjs-utils

使用 🌲

import utils from "wjs-utils";
utils.isEmail("aaa@123.com")

or

import { isEmail } from "wjs-utils";
isEmail("aaa@123.com")

or

const utils = require("wjs-utils");

持续更新中 ~ 🚀🚀🚀

isEmail(email) ⇒ boolean

判断是否为邮箱

ParamTypeDescription
emailstringemail

Example

isEmail("aaa@qq.com") // true

Example

isEmail("aaqq.com") // false

isPhone(phone) ⇒ boolean

判断是否为手机号码(最宽松)

ParamType
phonenumber | string

Example

isPhone(13541231213) //true

Example

isPhone(123) //false

isIdCard(idcard) ⇒ boolean

判断是否为身份证号码(支持一代/二代)

ParamType
idcardstring | number

Example

isIdCard(510902198910124421) // true

Example

isIdCard(123) // false

sleep(time) ⇒ Promise

延迟多少秒后继续执行

ParamType
timenumber

Example

sleep(1)

formatUrl(url) ⇒ Object

解析url参数为object

ParamType
urlstring

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)

保存文件

ParamType
blob*
param1*

Author

wjs email:imwangxuan@gmail.com

License

MIT License © 2022 wjs

1.0.2

2 years ago

1.0.1

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.10

2 years ago

1.0.0

2 years ago