# commonjs-set2

> 常用的js集合

Latest version **1.0.2** (published 2022-01-13) · ISC license · 0 weekly downloads

## Install

```sh
npm install commonjs-set2
pnpm add commonjs-set2
yarn add commonjs-set2
bun add commonjs-set2
```

## 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.2 |
| Published | 2022-01-13 |
| First published | 2022-01-13 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 12.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | coderzb |
| Maintainers | coderzb |

## Links

- npm: https://www.npmjs.com/package/commonjs-set2
- npm.io page: https://npm.io/package/commonjs-set2

## Recent versions

- 1.0.2 (latest) — 2022-01-13

## README

#

# install

`npm install commonjs-set2 --save`

# npm

`https://www.npmjs.com/package/commonjs-set2`

# github

# usage

**main.js**

```
import common from 'commonjs-set2';
Vue.prototype.$common = common  // 注册为全局变量
```

**xxxx.vue 文件**

- 判断手机号格式 true 表示正确的手机号，false 表示错误的手机号

`this.$common.isTelFunc('手机号码')`

- file 转 base64

`this.$common.fileToBase64(file对象)`

- 时间戳转年月日时分秒 file 转 base64

vue 中使用方法如下

```
<template slot="timeTransform" slot-scope="text, record">
    <span>{{ record.changeTime | formatDate }}</span>
</template>
```

```
 filters: {
    formatDate(time) {
      let date = new Date(time);
      console.log(new Date(time));
      return formatDate(date, "yyyy-MM-dd hh:mm");
    }
  },
```

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