1.2.9 • Published 5 months ago

@vbs/utils v1.2.9

Weekly downloads
-
License
-
Repository
-
Last release
5 months ago

VUtils

Team front end tool library

npm version GitHub issues GitHub forks GitHub stars GitHub license

Install

npm i @vbs/utils -S

Use

Mode 1

<script src="//cdn.jsdelivr.net/npm/@vbs/utils/dist/index.umd.js"></script>
<script>
  console.log(window.VUtils);
  const { isQQ, getType } = window.VUtils;

  console.log(isQQ(2323333339)); // true
  console.log(isQQ(1000)); // false

  console.log(getType(true)); // boolean
  console.log(getType(0)); // number
</script>

Mode 2

<script type="module">
  import { isQQ, getType } = '../dist/index.esm.js';

  console.log(isQQ(2323333339)); // true
  console.log(isQQ(1000)); // false

  console.log(getType(true)); // boolean
  console.log(getType(0)); // number
</script>

Mode 3

import { isQQ, getType } from "@vbs/utils";

console.log(isQQ(2323333339)); // true
console.log(isQQ(1000)); // false

console.log(getType(true)); // boolean
console.log(getType(0)); // number

API

  • 校验
    1. isQQ: (data: string | number) => boolean 校验是否是 QQ 号
    2. isPhone: (data: string | number) => boolean 校验是否是手机号
    3. isIDCard: (data: string) => boolean 校验是否是身份证号
    4. isEmail: (data: string) => boolean 校验是否是邮箱
    5. isBankCard: (data: string|number) => boolean 校验是否是银行卡
    6. isName: (data: string, type: "CN" | "EN") => boolean 校验是否是姓名
  • 类型
    1. getType: (data: unknown) => string 获取数据类型
  • 方法
    1. compressImage: (file: File, quality = 1) => Promise\<File> | Error 压缩图片
    2. parseUrl: (url: string) => object | null 获取 URL 的相关对象
    3. dataURLtoBlob: (dataURL: string) => Blob | null 将 Base64 字符串转为 Blob 对象
    4. dataURLtoFile: (dataURL: string, fileName: string) => File | null 将 Base64 字符串转为 File 对象
  • 函数
    1. cloneDeep: (data: Array | Record<string | number, unknown>) => Array | Record<string | number, unknown>
1.2.9

5 months ago

1.2.8

7 months ago

1.2.7

9 months ago

1.2.6

9 months ago

1.2.5

9 months ago

1.2.4

9 months ago

1.2.0

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.1.9

2 years ago

1.1.8

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.0.2

2 years ago

1.1.0

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

3 years ago