# andy-common

> 更新使用说明

Latest version **1.0.7** (published 2022-12-27) · ISC license · 0 weekly downloads

## Install

```sh
npm install andy-common
pnpm add andy-common
yarn add andy-common
bun add andy-common
```

## 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.7 |
| Published | 2022-12-27 |
| First published | 2022-08-30 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Andy |
| Maintainers | mr.zxh |

## Links

- npm: https://www.npmjs.com/package/andy-common
- npm.io page: https://npm.io/package/andy-common

## Recent versions

- 1.0.7 (latest) — 2022-12-27
- 1.0.6 — 2022-09-01
- 1.0.5 — 2022-09-01
- 1.0.4 — 2022-09-01
- 1.0.3 — 2022-09-01
- 1.0.2 — 2022-09-01
- 1.0.1 — 2022-09-01
- 1.0.0 — 2022-08-30

## README

# 内容
**JavaScript工具库，包含一些个人在工作中常用的方法**  

1. 文件上传和下载处理方法
2. 变量值判断，number 类型的 0 会判断为 true
3. 用*号隐藏部分字符串
4. 数组去重

# 安装
```js
npm i andy-common
npm i andy-common@版本号
```

# 使用说明
### 局部引入
```js
import { acm } from "@/utils/index.js";
```
在引入页面直接使用 acm.method()调用
```js
acm.sense(0) //  true
acm.sense(null) // false
```
### 全局引入
**在Vue中使用**

在main.js中添加以下代码

```js
import { acm } from "@/utils/index.js";
Vue.prototype.acm = acm;
```
使用方法
```js
this.acm.sense(0) //  true
```

[详细使用文档]: https://note.youdao.com/s/aSZgcUOc

| 方法                               | 描述                                        | 接收值                                                  |
| ---------------------------------- | ------------------------------------------- | ------------------------------------------------------- |
| sense(value)                       | 校验值是否有意义，等同于TypeScript中的 \|\| | 任意值                                                  |
| downfile(file, name)               | 下载文件（仅适用于PC端）                    | 文件、文件名                                            |
| downlink(url, name)                | 下载文件（仅适用于PC端）                    | 文件地址、文件名                                        |
| hideStr(data, start, stop, symbol) | 隐藏字符串                                  | 字符串、开始隐藏下标、结束隐藏下标、替换字符（默认为*） |
|                                    |                                             |                                                         |

# 注意
2.0版本之前仅供个人学习使用，不保证稳定性和兼容性

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