1.0.2 • Published 2 years ago

utilsall v1.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

utilsall

description: 提供常用的 utils

install

npm i utilsall

use

1

<script src="https://cdn.jsdelivr.net/npm/utilsall/dist/index.umd.js"></script>
<script>
  console.log(window.VUtils);
  const { isPhone, isCard } = window.VUtils;
  console.log(isPhone(15023509833)); // true
  console.log(isCard(0)); // false
</script>

2

import { isQQ, getType } from "utilsall";
console.log(isQQ(2323333339)); // true
console.log(getType({})); // object

API

  • 校验
    1. isCard: (data: string) => 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 对象
1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago