# thepaper-utils

Latest version **1.0.16** (published 2022-04-26) · ISC license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.16 |
| Published | 2022-04-26 |
| First published | 2022-01-21 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 81.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | thepaper |
| Maintainers | zhouzhongyu |
| Keywords | thepaper-utils |

## Links

- npm: https://www.npmjs.com/package/thepaper-utils
- npm.io page: https://npm.io/package/thepaper-utils

## Recent versions

- 1.0.16 (latest) — 2022-04-26
- 1.0.15 — 2022-03-31
- 1.0.14 — 2022-03-14
- 1.0.13 — 2022-03-14
- 1.0.12 — 2022-03-14
- 1.0.11 — 2022-03-14
- 1.0.10 — 2022-01-24
- 1.0.9 — 2022-01-24
- 1.0.8 — 2022-01-24
- 1.0.7 — 2022-01-24
- 1.0.6 — 2022-01-24
- 1.0.5 — 2022-01-24
- 1.0.4 — 2022-01-24
- 1.0.2 — 2022-01-24
- 1.0.1 — 2022-01-24
- … 1 more at https://npm.io/package/thepaper-utils/versions

## README

# 澎湃前端工具库


## 📦 Install

1. 支持打包压缩版(x.min.js)和非压缩版本(x.js)。

2. 支持 AMD/CJS/ESM 模块引入。

3. 支持通过script脚本直接引入链接。


```
// ESM
import * as utils from 'thepaper-utils';

//cjs
const Tool = require('thepaper-utils');

// AMD
require(['thepaper-utils'],function(){
  ...
})

// script 脚本
<script src="https://xxx.com/thepaper-utils.min.js"></script>

```

```
npm i thepaper-utils
```


```
yarn add thepaper-utils
```

## 🔨 Usage

### import utils from 'thepaper-utils'

| 方法  | 调用  | 说明 | 返回|
|:------------- |:---------------:| -------------:| -------------:|
| iosOrAndroid | utils.iosOrAndroid() | 判断当前所在的环境 | ios\android\undefined |
| checkCode    | utils.checkCode(value, type)| value: 传入需要验证的值<br/>type: phone\mail\idcard\account\number | true\false |
| getQuery | utils.getQuery() | 获取url的参数 | {id: 'xxx', age: 'xxx'} |
| wxShare | utils.wxShare(wxConfig, shareData) | 微信分享 | wxConfig: { appId, timestamp, nonceStr, signature, jsApiList（非必选） } <br/> shareData: { title, link, imgUrl, desc } |

### \<script src="https://xxx.com/thepaper-utils.min.js"></script>

调用方法同上，暴露出来的是 **utils**

## Use One
```
import utils from 'thepaper-utils';

console.log(utils.iosOrAndroid());
```

## Use Two
```
<script src="https://xxx.com/thepaper-utils.min.js"></script>

<script>
	console.log(utils.iosOrAndroid())
</script>
```

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