# wjs-utils

> 通用工具函数

Latest version **1.0.10** (published 2022-08-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install wjs-utils
pnpm add wjs-utils
yarn add wjs-utils
bun add wjs-utils
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.10 |
| Published | 2022-08-31 |
| First published | 2022-08-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 11.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | nice_wx |

## Links

- npm: https://www.npmjs.com/package/wjs-utils
- Repository: https://github.com/betteroneday/wjs-utils
- Homepage: https://github.com/betteroneday/wjs-utils#readme
- Issues: https://github.com/betteroneday/wjs-utils/issues
- npm.io page: https://npm.io/package/wjs-utils

## Recent versions

- 1.0.10 (latest) — 2022-08-31
- 1.0.9 — 2022-08-31
- 1.0.8 — 2022-08-31
- 1.0.7 — 2022-08-31
- 1.0.6 — 2022-08-31
- 1.0.5 — 2022-08-31
- 1.0.4 — 2022-08-31
- 1.0.3 — 2022-08-31
- 1.0.2 — 2022-08-31
- 1.0.1 — 2022-08-29
- 1.0.0 — 2022-08-24

## README

# wjs-utils⚡

[![npm version](https://badge.fury.io/js/wjs-utils.svg)](https://www.npmjs.com/package/wjs-utils)

# 安装 💡
```ball
yarn add wjs-utils
```
or

```ball
npm install wjs-utils
```

# 使用 🌲
```JavaScript
import utils from "wjs-utils";
utils.isEmail("aaa@123.com")
```

or

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

or

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

# 持续更新中 ～ 🚀🚀🚀


## isEmail(email) ⇒ <code>boolean</code>
判断是否为邮箱

| Param | Type | Description |
| --- | --- | --- |
| email | <code>string</code> | email |

**Example**  
```js
isEmail("aaa@qq.com") // true
```
**Example**  
```js
isEmail("aaqq.com") // false
```
<a name="isPhone"></a>

## isPhone(phone) ⇒ <code>boolean</code>
判断是否为手机号码（最宽松） 

| Param | Type |
| --- | --- |
| phone | <code>number</code> \| <code>string</code> | 

**Example**  
```js
isPhone(13541231213) //true
```
**Example**  
```js
isPhone(123) //false
```
<a name="isIdCard"></a>

## isIdCard(idcard) ⇒ <code>boolean</code>
判断是否为身份证号码（支持一代/二代）

| Param | Type |
| --- | --- |
| idcard | <code>string</code> \| <code>number</code> | 

**Example**  
```js
isIdCard(510902198910124421) // true
```
**Example**  
```js
isIdCard(123) // false
```

<a name="sleep"></a>

## sleep(time) ⇒ <code>Promise</code>
延迟多少秒后继续执行 

| Param | Type |
| --- | --- |
| time | <code>number</code> | 

**Example**  
```js
sleep(1)
```

<a name="formatUrl"></a>

## formatUrl(url) ⇒ <code>Object</code>
解析url参数为object

| Param | Type |
| --- | --- |
| url | <code>string</code> | 

**Example**  
```js
formatUrl("http://www.baidu.com?a=1&b=aaa") // {a:'1',b:'aaa'}
```
**Example**  
```js
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 | <code>\*</code> | 
| param1 | <code>\*</code> | 

## Author

wjs email:imwangxuan@gmail.com

## License

[MIT](./LICENSE) License © 2022 [wjs](https://github.com/betteroneday)

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