├── .babelrc
├── .github
└── ISSUE_TEMPLATE
│ └── -----------------.md
├── .gitignore
├── .npmignore
├── .prettierrc
├── .vscode
└── settings.json
├── LICENSE
├── README.md
├── _basic
├── copyToClipboard.ts
├── getFromClipboard.ts
├── getTypeOf.ts
├── index.ts
├── is.ts
├── removeHTMLTag.ts
├── throttle.ts
└── wait.ts
├── _browser
├── clearCookie.ts
├── getBaseUrl.ts
├── getCookie.ts
├── getUrlParams.ts
├── goToTop.ts
├── index.ts
├── isBrowser.ts
└── log.ts
├── _calc
├── average.ts
├── coorDistance.ts
├── diffCount.ts
├── index.ts
└── sum.ts
├── _random
├── index.ts
├── randomColor.ts
├── randomIP.ts
└── randomInt.ts
├── _regex
├── index.ts
├── isChinese.ts
├── isEmail.ts
├── isIdCard.ts
├── isMobile.ts
├── isRegexWith.ts
└── isUrl.ts
├── _time
├── diffDays.ts
├── formatSeconds.ts
└── index.ts
├── index.ts
├── jest.config.ts
├── lib
├── index.d.ts
├── index.js
├── index.js.map
├── index.min.js
├── index.min.js.map
├── index.min.mjs
├── index.min.mjs.map
├── index.mjs
└── index.mjs.map
├── package.json
├── pnpm-lock.yaml
├── rollup.config.js
├── static
├── atools_logo.png
└── wechat.png
├── test
├── basic
│ └── is.test.ts
├── browser
│ ├── getBaseUrl.test.ts
│ └── getUrlParams.test.ts
├── calc
│ ├── average.test.ts
│ ├── coorDistance.test.ts
│ ├── diffCount.test.ts
│ └── sum.test.ts
├── fn
│ └── throttle.test.ts
├── html
│ └── removeHTMLTag.test.ts
├── regex
│ ├── isChinese.test.ts
│ ├── isEmail.test.ts
│ ├── isIdCard.test.ts
│ ├── isMobile.test.ts
│ ├── isRegexWith.test.ts
│ └── isUrl.test.ts
└── time
│ ├── diffDays.test.ts
│ └── formatSeconds.test.ts
└── tsconfig.json
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": ["@babel/preset-env", "@babel/preset-typescript"]
3 | }
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/-----------------.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: "【需求】描述所需要的功能、业务场景"
3 | about: Describe the required functions and business scenarios
4 | title: ''
5 | labels: 需求
6 | assignees: wangdaoo
7 |
8 | ---
9 |
10 | ### 你希望得到的功能
11 |
12 |
13 |
14 | ### 业务场景
15 |
16 |
17 |
18 | ### 数据结构描述
19 |
20 |
21 |
22 | ### 备注
23 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | dist/
2 | node_modules
3 | WORKFLOW.md
4 | coverage/
5 | demo/
6 | .vscode
7 | .DS_Store
--------------------------------------------------------------------------------
/.npmignore:
--------------------------------------------------------------------------------
1 | # 忽略目录
2 | .DS_Store
3 | public/
4 | examples/
5 | packages/
6 | basic/
7 | test/
8 | coverage/
9 | _time/
10 | _senior/
11 | _regex/
12 | _random/
13 | _calc/
14 | _browser/
15 | _basic/
16 | static/
17 | .github/
18 |
19 | # 忽略指定文件
20 | .gitignore
21 | babel.config.js
22 | jest.config.ts
23 | *.map
24 | .prettierrc
25 | rollup.config.js
26 | pnpm-lock.yaml
27 | WORKFLOW.md
28 | index.ts
29 | .npmignore
30 | .babelrc
31 | tsconfig.json
32 | test.js
33 | demo/
34 |
35 |
36 | # local env files
37 | .env.local
38 | .env.*.local
39 |
40 | # Log files
41 | npm-debug.log*
42 | yarn-debug.log*
43 | yarn-error.log*
44 |
45 | # Editor directories and files
46 | .idea
47 | .vscode
48 | *.suo
49 | *.ntvs*
50 | *.njsproj
51 | *.sln
52 | *.sw?
--------------------------------------------------------------------------------
/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "tabWidth": 2,
3 | "printWidth": 120,
4 | "semi": true,
5 | "singleQuote": true,
6 | "arrowParens": "avoid"
7 | }
8 |
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "cSpell.words": [
3 | "atools",
4 | "atoolsjs",
5 | "coor",
6 | "mkdir",
7 | "Parens",
8 | "pnpm"
9 | ]
10 | }
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 山人自有妙计
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # aTools-js
2 |
3 |
4 |

5 |
6 |
7 |
8 |
9 |
10 |
11 |

12 |

13 |

14 |

15 |

16 |
17 |
18 |
19 |
20 |
21 |
22 | ## 轻松上手
23 |
24 | ```bash
25 | # npm
26 | npm install atools-js
27 |
28 | # yarn
29 | yarn add atools-js
30 |
31 | # pnpm 🔥
32 | pnpm add atools-js
33 | ```
34 |
35 | > 如果你不想在项目中引入太多依赖,而又想使用某一个或几个方法
36 | >
37 | > 那么可以复制文档中的源码,在你的项目中引入
38 |
39 | ## 源码获取
40 |
41 | ```bash
42 | # clone
43 | git clone git@github.com:wangdaoo/atools.git
44 |
45 | # enter
46 | cd atools
47 |
48 | # install
49 | pnpm/npm/yarn install
50 | ```
51 |
52 | ## bug
53 |
54 | [Issues · atools](https://github.com/wangdaoo/atools/issues)
55 |
56 | ## 反馈与共建
57 |
58 | 请访问 [GitHub](https://github.com/wangdaoo/atools) 或添加微信进群:
59 |
60 |
61 |

62 |
63 |
--------------------------------------------------------------------------------
/_basic/copyToClipboard.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @func copyToClipboard
3 | * @desc 📝 Copy text to clipboard
4 | * @param {string} text
5 | * @returns {Promise}
6 | */
7 | export const copyToClipboard = (text: string): Promise => {
8 | return new Promise((resolve, reject) => {
9 | const textArea = document.createElement('textarea');
10 | textArea.value = text;
11 | textArea.style.position = 'fixed';
12 | textArea.style.top = '0';
13 | textArea.style.left = '0';
14 | textArea.style.opacity = '0';
15 | document.body.appendChild(textArea);
16 | textArea.focus();
17 | textArea.select();
18 | try {
19 | // execCommand() API 已废弃⚠️
20 | // document.execCommand("copy");
21 | document.queryCommandValue('copy');
22 | resolve();
23 | } catch (err) {
24 | reject(err);
25 | }
26 | document.body.removeChild(textArea);
27 | });
28 | };
29 |
--------------------------------------------------------------------------------
/_basic/getFromClipboard.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @func getFromClipboard
3 | * @desc 📝 Get text from clipboard
4 | * @returns {Promise}
5 | */
6 | export const getFromClipboard = (): Promise => {
7 | return new Promise((resolve, reject) => {
8 | navigator.clipboard.readText()
9 | .then(text => {
10 | resolve(text);
11 | })
12 | .catch(err => {
13 | reject(err);
14 | });
15 | });
16 | };
17 |
--------------------------------------------------------------------------------
/_basic/getTypeOf.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @param {unknown} param
3 | * @returns {string}
4 | * String, Number, Boolean, Symbol, Null, Undefined, Object
5 | * Array, RegExp, Date, Error, Function, AsyncFunction, HTMLDocument
6 | */
7 | export const getTypeOf = (param: unknown): string => {
8 | const type = Object.prototype.toString.call(param).slice(8, -1);
9 | return type.toLowerCase();
10 | };
11 |
--------------------------------------------------------------------------------
/_basic/index.ts:
--------------------------------------------------------------------------------
1 | export { getTypeOf } from './getTypeOf';
2 | export { is } from './is';
3 | export { wait } from './wait';
4 | export { copyToClipboard } from './copyToClipboard';
5 | export { getFromClipboard } from './getFromClipboard';
6 | export { throttle } from './throttle';
7 | export { removeHTMLTag } from './removeHTMLTag';
8 |
--------------------------------------------------------------------------------
/_basic/is.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @func is
3 | * @param {any} value
4 | * @param {string} type
5 | */
6 | import { getTypeOf } from './getTypeOf';
7 |
8 | export const is = (value: any, type: string): boolean => {
9 | return getTypeOf(value) === type.toLowerCase();
10 | }
11 |
--------------------------------------------------------------------------------
/_basic/removeHTMLTag.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @func removeHTMLTag
3 | * @param {string} str
4 | * @return {string}
5 | * @desc 📝 去掉文本中所有标签,只保留文本
6 | */
7 | export const removeHTMLTag = (str: string): string => str.replace(/<[^>]+>/g, '');
8 |
--------------------------------------------------------------------------------
/_basic/throttle.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @func throttle
3 | * @desc 📝 函数节流,每隔一段时间执行一次,防止函数过于频繁调用,导致性能问题
4 | * @param {Function} fn
5 | * @param {number} [ms=1000]
6 | * @returns {Function}
7 | */
8 | export const throttle = (fn: Function, ms: number = 1000): Function => {
9 | let isRunning = false;
10 | return (...args: any[]) => {
11 | if (isRunning) return;
12 | isRunning = true;
13 | setTimeout(() => {
14 | fn(...args);
15 | isRunning = false;
16 | }, ms);
17 | }
18 | }
--------------------------------------------------------------------------------
/_basic/wait.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * wait
3 | * @param {number} milliseconds
4 | */
5 | export const wait = async (milliseconds: number) => new Promise(resolve => setTimeout(resolve, milliseconds));
6 |
--------------------------------------------------------------------------------
/_browser/clearCookie.ts:
--------------------------------------------------------------------------------
1 | import { isBrowser } from './isBrowser';
2 | import { getCookie } from './getCookie';
3 | /**
4 | * Clean Cookies
5 | * (/^ +/, '') 清除头部空格
6 | * match(/=(\S*)/)[1] 提取cookie值
7 | * HttpOnly 不允许脚本读取,客户端无法操作
8 | */
9 |
10 | export const clearCookie = () => {
11 | // Environmental Test
12 | if (!isBrowser) throw new Error("Non-browser environment, unavailable 'cleanCookies'");
13 |
14 | if (!document.cookie) throw new Error('No Cookie Found');
15 |
16 | for (let i = 0; i < getCookie().length; i++) {
17 | const element = getCookie()[i];
18 | document.cookie = element.replace(/^ +/, '').replace(element.match(/=(\S*)/)[1], ``);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/_browser/getBaseUrl.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @func getBaseUrl
3 | * @param {string} url
4 | * @returns {string}
5 | * @desc 📝 获取 ? 前面的url
6 | */
7 | export const getBaseUrl = (url: string): string => {
8 | return url.includes('?') ? url.split('?')[0] : url;
9 | };
10 |
--------------------------------------------------------------------------------
/_browser/getCookie.ts:
--------------------------------------------------------------------------------
1 | import { isBrowser } from './isBrowser';
2 |
3 | /**
4 | * 获取cookie
5 | * new RegExp(`(^| )${name}=([^;]*)(;|$)`) 匹配 name=value 值
6 | * @param name[可选] cookie名称
7 | * @returns {Array | string | undefined}
8 | */
9 |
10 | export const getCookie = (name?: string): Array | string | undefined => {
11 | // Environmental Test
12 | if (!isBrowser) throw new Error("Non-browser environment, unavailable 'getCookie'");
13 |
14 | if (!document.cookie) throw new Error('No Cookie Found');
15 |
16 | if (name) {
17 | const reg = new RegExp(`(^| )${name}=([^;]*)(;|$)`);
18 | const arr = document.cookie.match(reg);
19 | return arr ? arr[2] : undefined;
20 | }
21 |
22 | // Get Cookies && String => Array
23 | return document.cookie.split(';');
24 | };
25 |
--------------------------------------------------------------------------------
/_browser/getUrlParams.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @func getUrlParams
3 | * @param {string} url
4 | * @returns {object}
5 | * @desc 📝 获取 url 中所有的参数,以对象的形式返回,如果参数名重复,则以数组的形式返回
6 | */
7 | export const getUrlParams = (url: string): object => {
8 | const params: { [key: string]: any } = {};
9 | const query = url.split('?')[1];
10 | if (!query) return params;
11 | const queryArr = query.split('&');
12 | queryArr.forEach((item: string) => {
13 | const [key, value] = item.split('=');
14 | if (params[key]) {
15 | if (Array.isArray(params[key])) {
16 | params[key].push(value);
17 | } else {
18 | params[key] = [params[key], value];
19 | }
20 | } else {
21 | params[key] = value;
22 | }
23 | });
24 | return params;
25 | }
--------------------------------------------------------------------------------
/_browser/goToTop.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @version v0.0.31
3 | * @func goToTop
4 | * @return {void}
5 | * @desc 📝 平滑滚动到顶部
6 | */
7 | export const goToTop = (): void => {
8 | const c = document?.documentElement?.scrollTop ?? document?.body?.scrollTop;
9 | if (c > 0) {
10 | window.requestAnimationFrame(goToTop);
11 | window.scrollTo(0, c - c / 8);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/_browser/index.ts:
--------------------------------------------------------------------------------
1 | export { isBrowser } from './isBrowser';
2 | export { getCookie } from './getCookie';
3 | export { clearCookie } from './clearCookie';
4 | export { getBaseUrl } from './getBaseUrl';
5 | export { getUrlParams } from './getUrlParams';
6 | export { goToTop } from './goToTop';
7 | export { log } from './log';
8 |
--------------------------------------------------------------------------------
/_browser/isBrowser.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * isBrowser
3 | * 检测代码是否运行在浏览器环境
4 | */
5 |
6 | export const isBrowser: boolean = typeof window === 'object' && typeof document === 'object';
7 |
--------------------------------------------------------------------------------
/_browser/log.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @func log
3 | * @desc 📝 Logs a message to the console.
4 | * @example log.info('Hello world'); log.error('Oh no!');
5 | */
6 |
7 | export const log = {
8 | info: (...args: any[]) => console.log(`%c%s`, 'color: #9E9E9E', ...args),
9 | error: (...args: any[]) => console.log(`%c%s`, 'color: #d81e06', ...args),
10 | warn: (...args: any[]) => console.log(`%c%s`, 'color: #ffc107', ...args),
11 | debug: (...args: any[]) => console.log(`%c%s`, 'color: #2196f3', ...args),
12 | success: (...args: any[]) => console.log(`%c%s`, 'color: #4caf50', ...args),
13 | color: (color: string) => (...args: any[]) => console.log(`%c%s`, `color: ${color}`, ...args) as any,
14 | };
15 |
--------------------------------------------------------------------------------
/_calc/average.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @func average
3 | * @desc 📝 计算数组的平均值
4 | * @param {number[]} numbers
5 | * @returns {number}
6 | * @example average([1, 2, 3, 4, 5]) // 3
7 | */
8 | export const average = (numbers: number[]): number => {
9 | return numbers.reduce((acc, curr) => acc + curr, 0) / numbers.length;
10 | };
11 |
--------------------------------------------------------------------------------
/_calc/coorDistance.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @version v0.0.31
3 | * @func coorDistance
4 | * @param {object} coor1 - 坐标1
5 | * @param {object} coor2 - 坐标2
6 | * @returns {number} - 距离
7 | * @desc 📝 计算两个坐标点之间的距离
8 | */
9 | interface Point {
10 | x: number;
11 | y: number;
12 | }
13 |
14 | export const coorDistance = (p1: Point, p2: Point): number => {
15 | const { x: x1, y: y1 } = p1;
16 | const { x: x2, y: y2 } = p2;
17 | return Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));
18 | };
19 |
--------------------------------------------------------------------------------
/_calc/diffCount.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @func diffCount
3 | * @param {number} a
4 | * @param {number} b
5 | * @returns {number}
6 | * @desc 计算两个数的差值
7 | */
8 | export const diffCount = (a: number, b: number): number => a > b ? a - b : b - a
--------------------------------------------------------------------------------
/_calc/index.ts:
--------------------------------------------------------------------------------
1 | export { average } from './average';
2 | export { sum } from './sum';
3 | export { diffCount } from './diffCount';
4 | export { coorDistance } from './coorDistance';
5 |
--------------------------------------------------------------------------------
/_calc/sum.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @func sum
3 | * @desc 📝 计算数组的和
4 | * @param {number[]} numbers
5 | * @returns {number}
6 | */
7 | export const sum = (numbers: number[]): number => {
8 | return numbers.reduce((acc, curr) => acc + curr, 0);
9 | };
10 |
--------------------------------------------------------------------------------
/_random/index.ts:
--------------------------------------------------------------------------------
1 | export { randomInt } from './randomInt';
2 | export { randomIP } from './randomIP';
3 | export { randomColor } from './randomColor';
4 |
--------------------------------------------------------------------------------
/_random/randomColor.ts:
--------------------------------------------------------------------------------
1 | import { randomInt } from './randomInt';
2 | /**
3 | * @func randomColor
4 | * @param {type} type - 0: rgb, 1: rgba, 2: hsl, 3: hsla, 4: hex
5 | * @returns {string} - random color
6 | * @desc 📝生成一个随机的颜色值
7 | */
8 |
9 | export const randomColor = (type: number = 0): string => {
10 | const rgb = `rgb(${randomInt(0, 255)}, ${randomInt(0, 255)}, ${randomInt(0, 255)})`;
11 | const rgba = `rgba(${randomInt(0, 255)}, ${randomInt(0, 255)}, ${randomInt(0, 255)}, ${(
12 | randomInt(0, 255) / 255.0
13 | ).toFixed(2)})`;
14 | const hsl = `hsl(${randomInt(0, 360)}, ${randomInt(0, 100)}%, ${randomInt(0, 100)}%)`;
15 | const hsla = `hsla(${randomInt(0, 360)}, ${randomInt(0, 100)}%, ${randomInt(0, 100)}%, ${(
16 | randomInt(0, 100) / 255.0
17 | ).toFixed(1)})`;
18 | const hex = `#${randomInt(0, 255).toString(16)}${randomInt(0, 255).toString(16)}${randomInt(0, 255).toString(16)}`;
19 | return type ? (type === 1 ? rgba : type === 2 ? hsl : type === 3 ? hsla : hex) : rgb;
20 | };
21 |
--------------------------------------------------------------------------------
/_random/randomIP.ts:
--------------------------------------------------------------------------------
1 | import { randomInt } from './randomInt'
2 |
3 | /**
4 | * @func randomIP
5 | * @param {number} type - 0: ipv4, 1: ipv6
6 | * @returns {string} - random ip address
7 | * @desc 生成一个随机的IP地址,可以是IPv4或者IPv6
8 | */
9 |
10 | export const randomIP = (type: number = 0): string => {
11 | const ipv4 = randomInt(0, 255) + '.' + randomInt(0, 255) + '.' + randomInt(0, 255) + '.' + randomInt(0, 255);
12 | const ipv6 =
13 | randomInt(0, 65535) +
14 | ':' +
15 | randomInt(0, 65535) +
16 | ':' +
17 | randomInt(0, 65535) +
18 | ':' +
19 | randomInt(0, 65535) +
20 | ':' +
21 | randomInt(0, 65535) +
22 | ':' +
23 | randomInt(0, 65535) +
24 | ':' +
25 | randomInt(0, 65535) +
26 | ':' +
27 | randomInt(0, 65535);
28 | return type ? ipv6 : ipv4;
29 | };
30 |
--------------------------------------------------------------------------------
/_random/randomInt.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @func randomInt
3 | * @param {number} min - min number
4 | * @param {number} max - max number
5 | * @returns {number} - random number
6 | */
7 | export const randomInt = (min: number, max: number): number => {
8 | return Math.floor(Math.random() * (max - min + 1) + min);
9 | }
--------------------------------------------------------------------------------
/_regex/index.ts:
--------------------------------------------------------------------------------
1 | export { isMobile } from './isMobile';
2 | export { isRegexWith } from './isRegexWith';
3 | export { isEmail } from './isEmail';
4 | export { isUrl } from './isUrl';
5 | export { isChinese } from './isChinese';
6 | export { isIdCard } from './isIdCard';
7 |
--------------------------------------------------------------------------------
/_regex/isChinese.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * 是否是中文
3 | * @param str 字符串
4 | * @returns {boolean}
5 | * @description Returns true if the string is a chinese.
6 | */
7 | export const isChinese = (str: string): boolean => {
8 | const reg = /^[\u4e00-\u9fa5]+$/;
9 | return reg.test(str);
10 | };
11 |
--------------------------------------------------------------------------------
/_regex/isEmail.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * 是否是邮箱
3 | * @param {string} str
4 | * @returns {boolean}
5 | * @description Returns true if the string is a email.
6 | */
7 |
8 | export const isEmail = (str: string): boolean => {
9 | const reg =
10 | /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
11 | return reg.test(str);
12 | };
13 |
--------------------------------------------------------------------------------
/_regex/isIdCard.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * 是否为身份证号: 支持(1/2)代,15位或18位
3 | * @param {string} str 身份证号
4 | * @param {number} type 1:15位,2:18位,默认0 同时匹配15位和18位
5 | * @returns {boolean}
6 | * @description Returns true if the string is a id card.
7 | */
8 | export const isIdCard = (str: string, type: number = 0): boolean => {
9 | // 1代身份证
10 | const reg1 = /^[1-9]\d{7}(?:0\d|10|11|12)(?:0[1-9]|[1-2][\d]|30|31)\d{3}$/;
11 | // 2代身份证
12 | const reg2 = /^[1-9]\d{5}(?:18|19|20)\d{2}(?:0[1-9]|10|11|12)(?:0[1-9]|[1-2]\d|30|31)\d{3}[\dXx]$/;
13 | const reg =
14 | /^\d{6}((((((19|20)\d{2})(0[13-9]|1[012])(0[1-9]|[12]\d|30))|(((19|20)\d{2})(0[13578]|1[02])31)|((19|20)\d{2})02(0[1-9]|1\d|2[0-8])|((((19|20)([13579][26]|[2468][048]|0[48]))|(2000))0229))\d{3})|((((\d{2})(0[13-9]|1[012])(0[1-9]|[12]\d|30))|((\d{2})(0[13578]|1[02])31)|((\d{2})02(0[1-9]|1\d|2[0-8]))|(([13579][26]|[2468][048]|0[048])0229))\d{2}))(\d|X|x)$/;
15 |
16 | switch (type) {
17 | case 1:
18 | return reg1.test(str);
19 | case 2:
20 | return reg2.test(str);
21 | default:
22 | return reg.test(str);
23 | }
24 | };
25 |
--------------------------------------------------------------------------------
/_regex/isMobile.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @param {string} str
3 | * @returns {boolean}
4 | * @description Returns true if the string is a mobile phone number.
5 | */
6 | export const isMobile = (str: string): boolean => {
7 | const reg = /^(?:(?:\+|00)86)?1(?:(?:3[\d])|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\d])|(?:9[189]))\d{8}$/;
8 | return reg.test(str);
9 | }
10 |
--------------------------------------------------------------------------------
/_regex/isRegexWith.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * 自定义正则表达式
3 | * @param {RegExp} regex 正则表达式
4 | * @param {string} str 字符串
5 | * @returns {boolean}
6 | */
7 |
8 | export const isRegexWith = (regex: RegExp, str: string): boolean => regex.test(str);
9 |
--------------------------------------------------------------------------------
/_regex/isUrl.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * 是否是url
3 | * @param {string} str
4 | * @returns {boolean}
5 | * @description Returns true if the string is a url.
6 | */
7 | export const isUrl = (str: string): boolean => {
8 | const reg = /^(((ht|f)tps?):\/\/)?([^!@#$%^&*?.\s-]([^!@#$%^&*?.\s]{0,63}[^!@#$%^&*?.\s])?\.)+[a-z]{2,6}\/?/;
9 | return reg.test(str);
10 | };
11 |
--------------------------------------------------------------------------------
/_time/diffDays.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @func diffDays
3 | * @desc 📝比较两个日期相差的天数
4 | * @param {Date} date1
5 | * @param {Date} date2
6 | * @returns {number}
7 | */
8 | export function diffDays(date1: Date, date2: Date): number {
9 | const time1 = date1.getTime();
10 | const time2 = date2.getTime();
11 | const diff = Math.abs(time1 >= time2 ? time1 - time2 : time2 - time1);
12 | return Math.floor(diff / (1000 * 60 * 60 * 24));
13 | }
14 |
--------------------------------------------------------------------------------
/_time/formatSeconds.ts:
--------------------------------------------------------------------------------
1 | import { is } from '../_basic/index'
2 | /**
3 | * @func formatSeconds
4 | * @param {number} seconds
5 | * @param {string} [format]
6 | * @returns {string} 'hh:mm:ss' | 'mm:ss'
7 | * @desc 📝格式化秒数, 可以指定格式, 默认为: 'mm:ss'.
8 | */
9 |
10 | export function formatSeconds(seconds: number, format?: string): string {
11 | if (!seconds && !is(seconds, 'number')) return '00:00';
12 | const hh = Math.floor(seconds / 3600);
13 | const mm = Math.floor((seconds % 3600) / 60);
14 | const ss = seconds % 60;
15 | switch (format) {
16 | case 'hh:mm:ss':
17 | return `${hh < 10 ? '0' + hh : hh}:${mm < 10 ? '0' + mm : mm}:${ss < 10 ? '0' + ss : ss}`;
18 | case 'mm:ss':
19 | if (hh) return `${hh * 60 + mm}:${ss < 10 ? '0' + ss : ss}`;
20 | return `${mm}:${ss < 10 ? '0' + ss : ss}`;
21 | default:
22 | if (hh) return `${hh * 60 + mm}:${ss < 10 ? '0' + ss : ss}`;
23 | return `${mm < 10 ? '0' + mm : mm}:${ss < 10 ? '0' + ss : ss}`;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/_time/index.ts:
--------------------------------------------------------------------------------
1 | export { diffDays } from './diffDays';
2 | export { formatSeconds } from './formatSeconds';
3 |
--------------------------------------------------------------------------------
/index.ts:
--------------------------------------------------------------------------------
1 | // basic function
2 | export * from './_basic/index';
3 |
4 | // senior function
5 | // export * from './senior/root';
6 |
7 | // browser
8 | export * from './_browser/index';
9 |
10 | // calc
11 | export * from './_calc/index';
12 |
13 | // regex
14 | export * from './_regex/index';
15 |
16 | // time
17 | export * from './_time/index';
18 |
19 | // random
20 | export * from './_random/index';
21 |
--------------------------------------------------------------------------------
/jest.config.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * For a detailed explanation regarding each configuration property and type check, visit:
3 | * https://jestjs.io/docs/configuration
4 | */
5 |
6 | export default {
7 | // All imported modules in your tests should be mocked automatically
8 | // automock: false,
9 |
10 | // Stop running tests after `n` failures
11 | // bail: 0,
12 |
13 | // The directory where Jest should store its cached dependency information
14 | // cacheDirectory: "/private/var/folders/g_/q1nqk8117bs9ws536t689v9r0000gn/T/jest_dx",
15 |
16 | // Automatically clear mock calls, instances and results before every test
17 | clearMocks: true,
18 |
19 | // Indicates whether the coverage information should be collected while executing the test
20 | collectCoverage: true,
21 |
22 | // An array of glob patterns indicating a set of files for which coverage information should be collected
23 | // collectCoverageFrom: undefined,
24 |
25 | // The directory where Jest should output its coverage files
26 | coverageDirectory: "coverage",
27 |
28 | // An array of regexp pattern strings used to skip coverage collection
29 | // coveragePathIgnorePatterns: [
30 | // "/node_modules/"
31 | // ],
32 |
33 | // Indicates which provider should be used to instrument code for coverage
34 | // coverageProvider: "babel",
35 |
36 | // A list of reporter names that Jest uses when writing coverage reports
37 | // coverageReporters: [
38 | // "json",
39 | // "text",
40 | // "lcov",
41 | // "clover"
42 | // ],
43 |
44 | // An object that configures minimum threshold enforcement for coverage results
45 | // coverageThreshold: undefined,
46 |
47 | // A path to a custom dependency extractor
48 | // dependencyExtractor: undefined,
49 |
50 | // Make calling deprecated APIs throw helpful error messages
51 | // errorOnDeprecated: false,
52 |
53 | // Force coverage collection from ignored files using an array of glob patterns
54 | // forceCoverageMatch: [],
55 |
56 | // A path to a module which exports an async function that is triggered once before all test suites
57 | // globalSetup: undefined,
58 |
59 | // A path to a module which exports an async function that is triggered once after all test suites
60 | // globalTeardown: undefined,
61 |
62 | // A set of global variables that need to be available in all test environments
63 | // globals: {},
64 |
65 | // The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
66 | // maxWorkers: "50%",
67 |
68 | // An array of directory names to be searched recursively up from the requiring module's location
69 | // moduleDirectories: [
70 | // "node_modules"
71 | // ],
72 |
73 | // An array of file extensions your modules use
74 | moduleFileExtensions: [ "js", "ts" ],
75 |
76 | // A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
77 | // moduleNameMapper: {},
78 |
79 | // An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
80 | // modulePathIgnorePatterns: [],
81 |
82 | // Activates notifications for test results
83 | // notify: false,
84 |
85 | // An enum that specifies notification mode. Requires { notify: true }
86 | // notifyMode: "failure-change",
87 |
88 | // A preset that is used as a base for Jest's configuration
89 | // preset: undefined,
90 |
91 | // Run tests from one or more projects
92 | // projects: undefined,
93 |
94 | // Use this configuration option to add custom reporters to Jest
95 | // reporters: undefined,
96 |
97 | // Automatically reset mock state before every test
98 | // resetMocks: false,
99 |
100 | // Reset the module registry before running each individual test
101 | // resetModules: false,
102 |
103 | // A path to a custom resolver
104 | // resolver: undefined,
105 |
106 | // Automatically restore mock state and implementation before every test
107 | // restoreMocks: false,
108 |
109 | // The root directory that Jest should scan for tests and modules within
110 | // rootDir: undefined,
111 |
112 | // A list of paths to directories that Jest should use to search for files in
113 | // roots: [
114 | // ""
115 | // ],
116 |
117 | // Allows you to use a custom runner instead of Jest's default test runner
118 | // runner: "jest-runner",
119 |
120 | // The paths to modules that run some code to configure or set up the testing environment before each test
121 | // setupFiles: [],
122 |
123 | // A list of paths to modules that run some code to configure or set up the testing framework before each test
124 | // setupFilesAfterEnv: [],
125 |
126 | // The number of seconds after which a test is considered as slow and reported as such in the results.
127 | // slowTestThreshold: 5,
128 |
129 | // A list of paths to snapshot serializer modules Jest should use for snapshot testing
130 | // snapshotSerializers: [],
131 |
132 | // The test environment that will be used for testing
133 | // testEnvironment: "jest-environment-node",
134 |
135 | // Options that will be passed to the testEnvironment
136 | // testEnvironmentOptions: {},
137 |
138 | // Adds a location field to test results
139 | // testLocationInResults: false,
140 |
141 | // The glob patterns Jest uses to detect test files
142 | testMatch: [
143 | "**/test/**/*.[jt]s",
144 | ],
145 |
146 | // An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
147 | testPathIgnorePatterns: [
148 | "/node_modules/",
149 | "/lib/"
150 | ],
151 |
152 | // The regexp pattern or array of patterns that Jest uses to detect test files
153 | // testRegex: [],
154 |
155 | // This option allows the use of a custom results processor
156 | // testResultsProcessor: undefined,
157 |
158 | // This option allows use of a custom test runner
159 | // testRunner: "jest-circus/runner",
160 |
161 | // This option sets the URL for the jsdom environment. It is reflected in properties such as location.href
162 | // testURL: "http://localhost",
163 |
164 | // Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout"
165 | // timers: "real",
166 |
167 | // A map from regular expressions to paths to transformers
168 | transform: {
169 | '^.+\\.ts$': 'ts-jest',
170 | },
171 |
172 | // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
173 | // transformIgnorePatterns: [
174 | // "/node_modules/",
175 | // "\\.pnp\\.[^\\/]+$"
176 | // ],
177 |
178 | // An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
179 | // unmockedModulePathPatterns: undefined,
180 |
181 | // Indicates whether each individual test should be reported during the run
182 | // verbose: undefined,
183 |
184 | // An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
185 | // watchPathIgnorePatterns: [],
186 |
187 | // Whether to use watchman for file crawling
188 | // watchman: true,
189 | };
190 |
--------------------------------------------------------------------------------
/lib/index.d.ts:
--------------------------------------------------------------------------------
1 | declare const getTypeOf: (param: unknown) => string;
2 |
3 | declare const is: (value: any, type: string) => boolean;
4 |
5 | declare const wait: (milliseconds: number) => Promise;
6 |
7 | declare const copyToClipboard: (text: string) => Promise;
8 |
9 | declare const getFromClipboard: () => Promise;
10 |
11 | declare const throttle: (fn: Function, ms?: number) => Function;
12 |
13 | declare const removeHTMLTag: (str: string) => string;
14 |
15 | declare const isBrowser: boolean;
16 |
17 | declare const getCookie: (name?: string) => Array | string | undefined;
18 |
19 | declare const clearCookie: () => void;
20 |
21 | declare const getBaseUrl: (url: string) => string;
22 |
23 | declare const getUrlParams: (url: string) => object;
24 |
25 | declare const goToTop: () => void;
26 |
27 | declare const log: {
28 | info: (...args: any[]) => void;
29 | error: (...args: any[]) => void;
30 | warn: (...args: any[]) => void;
31 | debug: (...args: any[]) => void;
32 | success: (...args: any[]) => void;
33 | color: (color: string) => (...args: any[]) => any;
34 | };
35 |
36 | declare const average: (numbers: number[]) => number;
37 |
38 | declare const sum: (numbers: number[]) => number;
39 |
40 | declare const diffCount: (a: number, b: number) => number;
41 |
42 | interface Point {
43 | x: number;
44 | y: number;
45 | }
46 | declare const coorDistance: (p1: Point, p2: Point) => number;
47 |
48 | declare const isMobile: (str: string) => boolean;
49 |
50 | declare const isRegexWith: (regex: RegExp, str: string) => boolean;
51 |
52 | declare const isEmail: (str: string) => boolean;
53 |
54 | declare const isUrl: (str: string) => boolean;
55 |
56 | declare const isChinese: (str: string) => boolean;
57 |
58 | declare const isIdCard: (str: string, type?: number) => boolean;
59 |
60 | declare function diffDays(date1: Date, date2: Date): number;
61 |
62 | declare function formatSeconds(seconds: number, format?: string): string;
63 |
64 | declare const randomInt: (min: number, max: number) => number;
65 |
66 | declare const randomIP: (type?: number) => string;
67 |
68 | declare const randomColor: (type?: number) => string;
69 |
70 | export { average, clearCookie, coorDistance, copyToClipboard, diffCount, diffDays, formatSeconds, getBaseUrl, getCookie, getFromClipboard, getTypeOf, getUrlParams, goToTop, is, isBrowser, isChinese, isEmail, isIdCard, isMobile, isRegexWith, isUrl, log, randomColor, randomIP, randomInt, removeHTMLTag, sum, throttle, wait };
71 |
--------------------------------------------------------------------------------
/lib/index.js:
--------------------------------------------------------------------------------
1 | (function (global, factory) {
2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
3 | typeof define === 'function' && define.amd ? define(['exports'], factory) :
4 | (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.atools = {}));
5 | })(this, (function (exports) { 'use strict';
6 |
7 | var getTypeOf = function getTypeOf(param) {
8 | var type = Object.prototype.toString.call(param).slice(8, -1);
9 | return type.toLowerCase();
10 | };
11 |
12 | var is = function is(value, type) {
13 | return getTypeOf(value) === type.toLowerCase();
14 | };
15 |
16 | /*! *****************************************************************************
17 | Copyright (c) Microsoft Corporation.
18 |
19 | Permission to use, copy, modify, and/or distribute this software for any
20 | purpose with or without fee is hereby granted.
21 |
22 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
23 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
24 | AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
25 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
26 | LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
27 | OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
28 | PERFORMANCE OF THIS SOFTWARE.
29 | ***************************************************************************** */
30 |
31 | function __awaiter(thisArg, _arguments, P, generator) {
32 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
33 | return new (P || (P = Promise))(function (resolve, reject) {
34 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
35 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
36 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
37 | step((generator = generator.apply(thisArg, _arguments || [])).next());
38 | });
39 | }
40 |
41 | function __generator(thisArg, body) {
42 | var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
43 | return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
44 | function verb(n) { return function (v) { return step([n, v]); }; }
45 | function step(op) {
46 | if (f) throw new TypeError("Generator is already executing.");
47 | while (_) try {
48 | if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
49 | if (y = 0, t) op = [op[0] & 2, t.value];
50 | switch (op[0]) {
51 | case 0: case 1: t = op; break;
52 | case 4: _.label++; return { value: op[1], done: false };
53 | case 5: _.label++; y = op[1]; op = [0]; continue;
54 | case 7: op = _.ops.pop(); _.trys.pop(); continue;
55 | default:
56 | if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
57 | if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
58 | if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
59 | if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
60 | if (t[2]) _.ops.pop();
61 | _.trys.pop(); continue;
62 | }
63 | op = body.call(thisArg, _);
64 | } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
65 | if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
66 | }
67 | }
68 |
69 | function __spreadArray(to, from, pack) {
70 | if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
71 | if (ar || !(i in from)) {
72 | if (!ar) ar = Array.prototype.slice.call(from, 0, i);
73 | ar[i] = from[i];
74 | }
75 | }
76 | return to.concat(ar || Array.prototype.slice.call(from));
77 | }
78 |
79 | var wait = function wait(milliseconds) {
80 | return __awaiter(void 0, void 0, void 0, function () {
81 | return __generator(this, function (_a) {
82 | return [2, new Promise(function (resolve) {
83 | return setTimeout(resolve, milliseconds);
84 | })];
85 | });
86 | });
87 | };
88 |
89 | var copyToClipboard = function copyToClipboard(text) {
90 | return new Promise(function (resolve, reject) {
91 | var textArea = document.createElement('textarea');
92 | textArea.value = text;
93 | textArea.style.position = 'fixed';
94 | textArea.style.top = '0';
95 | textArea.style.left = '0';
96 | textArea.style.opacity = '0';
97 | document.body.appendChild(textArea);
98 | textArea.focus();
99 | textArea.select();
100 |
101 | try {
102 | document.queryCommandValue('copy');
103 | resolve();
104 | } catch (err) {
105 | reject(err);
106 | }
107 |
108 | document.body.removeChild(textArea);
109 | });
110 | };
111 |
112 | var getFromClipboard = function getFromClipboard() {
113 | return new Promise(function (resolve, reject) {
114 | navigator.clipboard.readText().then(function (text) {
115 | resolve(text);
116 | })["catch"](function (err) {
117 | reject(err);
118 | });
119 | });
120 | };
121 |
122 | var throttle = function throttle(fn, ms) {
123 | if (ms === void 0) {
124 | ms = 1000;
125 | }
126 |
127 | var isRunning = false;
128 | return function () {
129 | var args = [];
130 |
131 | for (var _i = 0; _i < arguments.length; _i++) {
132 | args[_i] = arguments[_i];
133 | }
134 |
135 | if (isRunning) return;
136 | isRunning = true;
137 | setTimeout(function () {
138 | fn.apply(void 0, args);
139 | isRunning = false;
140 | }, ms);
141 | };
142 | };
143 |
144 | var removeHTMLTag = function removeHTMLTag(str) {
145 | return str.replace(/<[^>]+>/g, '');
146 | };
147 |
148 | function _typeof(obj) {
149 | "@babel/helpers - typeof";
150 |
151 | return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
152 | return typeof obj;
153 | } : function (obj) {
154 | return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
155 | }, _typeof(obj);
156 | }
157 |
158 | var isBrowser = (typeof window === "undefined" ? "undefined" : _typeof(window)) === 'object' && (typeof document === "undefined" ? "undefined" : _typeof(document)) === 'object';
159 |
160 | var getCookie = function getCookie(name) {
161 | if (!isBrowser) throw new Error("Non-browser environment, unavailable 'getCookie'");
162 | if (!document.cookie) throw new Error('No Cookie Found');
163 |
164 | if (name) {
165 | var reg = new RegExp("(^| )".concat(name, "=([^;]*)(;|$)"));
166 | var arr = document.cookie.match(reg);
167 | return arr ? arr[2] : undefined;
168 | }
169 |
170 | return document.cookie.split(';');
171 | };
172 |
173 | var clearCookie = function clearCookie() {
174 | if (!isBrowser) throw new Error("Non-browser environment, unavailable 'cleanCookies'");
175 | if (!document.cookie) throw new Error('No Cookie Found');
176 |
177 | for (var i = 0; i < getCookie().length; i++) {
178 | var element = getCookie()[i];
179 | document.cookie = element.replace(/^ +/, '').replace(element.match(/=(\S*)/)[1], "");
180 | }
181 | };
182 |
183 | var getBaseUrl = function getBaseUrl(url) {
184 | return url.includes('?') ? url.split('?')[0] : url;
185 | };
186 |
187 | var getUrlParams = function getUrlParams(url) {
188 | var params = {};
189 | var query = url.split('?')[1];
190 | if (!query) return params;
191 | var queryArr = query.split('&');
192 | queryArr.forEach(function (item) {
193 | var _a = item.split('='),
194 | key = _a[0],
195 | value = _a[1];
196 |
197 | if (params[key]) {
198 | if (Array.isArray(params[key])) {
199 | params[key].push(value);
200 | } else {
201 | params[key] = [params[key], value];
202 | }
203 | } else {
204 | params[key] = value;
205 | }
206 | });
207 | return params;
208 | };
209 |
210 | var goToTop = function goToTop() {
211 | var _a, _b, _c;
212 |
213 | var c = (_b = (_a = document === null || document === void 0 ? void 0 : document.documentElement) === null || _a === void 0 ? void 0 : _a.scrollTop) !== null && _b !== void 0 ? _b : (_c = document === null || document === void 0 ? void 0 : document.body) === null || _c === void 0 ? void 0 : _c.scrollTop;
214 |
215 | if (c > 0) {
216 | window.requestAnimationFrame(goToTop);
217 | window.scrollTo(0, c - c / 8);
218 | }
219 | };
220 |
221 | var log = {
222 | info: function info() {
223 | var args = [];
224 |
225 | for (var _i = 0; _i < arguments.length; _i++) {
226 | args[_i] = arguments[_i];
227 | }
228 |
229 | return console.log.apply(console, __spreadArray(["%c%s", 'color: #9E9E9E'], args, false));
230 | },
231 | error: function error() {
232 | var args = [];
233 |
234 | for (var _i = 0; _i < arguments.length; _i++) {
235 | args[_i] = arguments[_i];
236 | }
237 |
238 | return console.log.apply(console, __spreadArray(["%c%s", 'color: #d81e06'], args, false));
239 | },
240 | warn: function warn() {
241 | var args = [];
242 |
243 | for (var _i = 0; _i < arguments.length; _i++) {
244 | args[_i] = arguments[_i];
245 | }
246 |
247 | return console.log.apply(console, __spreadArray(["%c%s", 'color: #ffc107'], args, false));
248 | },
249 | debug: function debug() {
250 | var args = [];
251 |
252 | for (var _i = 0; _i < arguments.length; _i++) {
253 | args[_i] = arguments[_i];
254 | }
255 |
256 | return console.log.apply(console, __spreadArray(["%c%s", 'color: #2196f3'], args, false));
257 | },
258 | success: function success() {
259 | var args = [];
260 |
261 | for (var _i = 0; _i < arguments.length; _i++) {
262 | args[_i] = arguments[_i];
263 | }
264 |
265 | return console.log.apply(console, __spreadArray(["%c%s", 'color: #4caf50'], args, false));
266 | },
267 | color: function color(_color) {
268 | return function () {
269 | var args = [];
270 |
271 | for (var _i = 0; _i < arguments.length; _i++) {
272 | args[_i] = arguments[_i];
273 | }
274 |
275 | return console.log.apply(console, __spreadArray(["%c%s", "color: ".concat(_color)], args, false));
276 | };
277 | }
278 | };
279 |
280 | var average = function average(numbers) {
281 | return numbers.reduce(function (acc, curr) {
282 | return acc + curr;
283 | }, 0) / numbers.length;
284 | };
285 |
286 | var sum = function sum(numbers) {
287 | return numbers.reduce(function (acc, curr) {
288 | return acc + curr;
289 | }, 0);
290 | };
291 |
292 | var diffCount = function diffCount(a, b) {
293 | return a > b ? a - b : b - a;
294 | };
295 |
296 | var coorDistance = function coorDistance(p1, p2) {
297 | var x1 = p1.x,
298 | y1 = p1.y;
299 | var x2 = p2.x,
300 | y2 = p2.y;
301 | return Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));
302 | };
303 |
304 | var isMobile = function isMobile(str) {
305 | var reg = /^(?:(?:\+|00)86)?1(?:(?:3[\d])|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\d])|(?:9[189]))\d{8}$/;
306 | return reg.test(str);
307 | };
308 |
309 | var isRegexWith = function isRegexWith(regex, str) {
310 | return regex.test(str);
311 | };
312 |
313 | var isEmail = function isEmail(str) {
314 | var reg = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
315 | return reg.test(str);
316 | };
317 |
318 | var isUrl = function isUrl(str) {
319 | var reg = /^(((ht|f)tps?):\/\/)?([^!@#$%^&*?.\s-]([^!@#$%^&*?.\s]{0,63}[^!@#$%^&*?.\s])?\.)+[a-z]{2,6}\/?/;
320 | return reg.test(str);
321 | };
322 |
323 | var isChinese = function isChinese(str) {
324 | var reg = /^[\u4e00-\u9fa5]+$/;
325 | return reg.test(str);
326 | };
327 |
328 | var isIdCard = function isIdCard(str, type) {
329 | if (type === void 0) {
330 | type = 0;
331 | }
332 |
333 | var reg1 = /^[1-9]\d{7}(?:0\d|10|11|12)(?:0[1-9]|[1-2][\d]|30|31)\d{3}$/;
334 | var reg2 = /^[1-9]\d{5}(?:18|19|20)\d{2}(?:0[1-9]|10|11|12)(?:0[1-9]|[1-2]\d|30|31)\d{3}[\dXx]$/;
335 | var reg = /^\d{6}((((((19|20)\d{2})(0[13-9]|1[012])(0[1-9]|[12]\d|30))|(((19|20)\d{2})(0[13578]|1[02])31)|((19|20)\d{2})02(0[1-9]|1\d|2[0-8])|((((19|20)([13579][26]|[2468][048]|0[48]))|(2000))0229))\d{3})|((((\d{2})(0[13-9]|1[012])(0[1-9]|[12]\d|30))|((\d{2})(0[13578]|1[02])31)|((\d{2})02(0[1-9]|1\d|2[0-8]))|(([13579][26]|[2468][048]|0[048])0229))\d{2}))(\d|X|x)$/;
336 |
337 | switch (type) {
338 | case 1:
339 | return reg1.test(str);
340 |
341 | case 2:
342 | return reg2.test(str);
343 |
344 | default:
345 | return reg.test(str);
346 | }
347 | };
348 |
349 | function diffDays(date1, date2) {
350 | var time1 = date1.getTime();
351 | var time2 = date2.getTime();
352 | var diff = Math.abs(time1 >= time2 ? time1 - time2 : time2 - time1);
353 | return Math.floor(diff / (1000 * 60 * 60 * 24));
354 | }
355 |
356 | function formatSeconds(seconds, format) {
357 | if (!seconds && !is(seconds, 'number')) return '00:00';
358 | var hh = Math.floor(seconds / 3600);
359 | var mm = Math.floor(seconds % 3600 / 60);
360 | var ss = seconds % 60;
361 |
362 | switch (format) {
363 | case 'hh:mm:ss':
364 | return "".concat(hh < 10 ? '0' + hh : hh, ":").concat(mm < 10 ? '0' + mm : mm, ":").concat(ss < 10 ? '0' + ss : ss);
365 |
366 | case 'mm:ss':
367 | if (hh) return "".concat(hh * 60 + mm, ":").concat(ss < 10 ? '0' + ss : ss);
368 | return "".concat(mm, ":").concat(ss < 10 ? '0' + ss : ss);
369 |
370 | default:
371 | if (hh) return "".concat(hh * 60 + mm, ":").concat(ss < 10 ? '0' + ss : ss);
372 | return "".concat(mm < 10 ? '0' + mm : mm, ":").concat(ss < 10 ? '0' + ss : ss);
373 | }
374 | }
375 |
376 | var randomInt = function randomInt(min, max) {
377 | return Math.floor(Math.random() * (max - min + 1) + min);
378 | };
379 |
380 | var randomIP = function randomIP(type) {
381 | if (type === void 0) {
382 | type = 0;
383 | }
384 |
385 | var ipv4 = randomInt(0, 255) + '.' + randomInt(0, 255) + '.' + randomInt(0, 255) + '.' + randomInt(0, 255);
386 | var ipv6 = randomInt(0, 65535) + ':' + randomInt(0, 65535) + ':' + randomInt(0, 65535) + ':' + randomInt(0, 65535) + ':' + randomInt(0, 65535) + ':' + randomInt(0, 65535) + ':' + randomInt(0, 65535) + ':' + randomInt(0, 65535);
387 | return type ? ipv6 : ipv4;
388 | };
389 |
390 | var randomColor = function randomColor(type) {
391 | if (type === void 0) {
392 | type = 0;
393 | }
394 |
395 | var rgb = "rgb(".concat(randomInt(0, 255), ", ").concat(randomInt(0, 255), ", ").concat(randomInt(0, 255), ")");
396 | var rgba = "rgba(".concat(randomInt(0, 255), ", ").concat(randomInt(0, 255), ", ").concat(randomInt(0, 255), ", ").concat((randomInt(0, 255) / 255.0).toFixed(2), ")");
397 | var hsl = "hsl(".concat(randomInt(0, 360), ", ").concat(randomInt(0, 100), "%, ").concat(randomInt(0, 100), "%)");
398 | var hsla = "hsla(".concat(randomInt(0, 360), ", ").concat(randomInt(0, 100), "%, ").concat(randomInt(0, 100), "%, ").concat((randomInt(0, 100) / 255.0).toFixed(1), ")");
399 | var hex = "#".concat(randomInt(0, 255).toString(16)).concat(randomInt(0, 255).toString(16)).concat(randomInt(0, 255).toString(16));
400 | return type ? type === 1 ? rgba : type === 2 ? hsl : type === 3 ? hsla : hex : rgb;
401 | };
402 |
403 | exports.average = average;
404 | exports.clearCookie = clearCookie;
405 | exports.coorDistance = coorDistance;
406 | exports.copyToClipboard = copyToClipboard;
407 | exports.diffCount = diffCount;
408 | exports.diffDays = diffDays;
409 | exports.formatSeconds = formatSeconds;
410 | exports.getBaseUrl = getBaseUrl;
411 | exports.getCookie = getCookie;
412 | exports.getFromClipboard = getFromClipboard;
413 | exports.getTypeOf = getTypeOf;
414 | exports.getUrlParams = getUrlParams;
415 | exports.goToTop = goToTop;
416 | exports.is = is;
417 | exports.isBrowser = isBrowser;
418 | exports.isChinese = isChinese;
419 | exports.isEmail = isEmail;
420 | exports.isIdCard = isIdCard;
421 | exports.isMobile = isMobile;
422 | exports.isRegexWith = isRegexWith;
423 | exports.isUrl = isUrl;
424 | exports.log = log;
425 | exports.randomColor = randomColor;
426 | exports.randomIP = randomIP;
427 | exports.randomInt = randomInt;
428 | exports.removeHTMLTag = removeHTMLTag;
429 | exports.sum = sum;
430 | exports.throttle = throttle;
431 | exports.wait = wait;
432 |
433 | Object.defineProperty(exports, '__esModule', { value: true });
434 |
435 | }));
436 | //# sourceMappingURL=index.js.map
437 |
--------------------------------------------------------------------------------
/lib/index.min.js:
--------------------------------------------------------------------------------
1 | !function(o,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((o="undefined"!=typeof globalThis?globalThis:o||self).atools={})}(this,(function(o){"use strict";var n=function(o){return Object.prototype.toString.call(o).slice(8,-1).toLowerCase()},t=function(o,t){return n(o)===t.toLowerCase()};
2 | /*! *****************************************************************************
3 | Copyright (c) Microsoft Corporation.
4 |
5 | Permission to use, copy, modify, and/or distribute this software for any
6 | purpose with or without fee is hereby granted.
7 |
8 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
9 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10 | AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
11 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12 | LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13 | OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14 | PERFORMANCE OF THIS SOFTWARE.
15 | ***************************************************************************** */
16 | function e(o,n,t,e){return new(t||(t=Promise))((function(r,c){function i(o){try{a(e.next(o))}catch(o){c(o)}}function u(o){try{a(e.throw(o))}catch(o){c(o)}}function a(o){var n;o.done?r(o.value):(n=o.value,n instanceof t?n:new t((function(o){o(n)}))).then(i,u)}a((e=e.apply(o,n||[])).next())}))}function r(o,n){var t,e,r,c,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return c={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(c[Symbol.iterator]=function(){return this}),c;function u(c){return function(u){return function(c){if(t)throw new TypeError("Generator is already executing.");for(;i;)try{if(t=1,e&&(r=2&c[0]?e.return:c[0]?e.throw||((r=e.return)&&r.call(e),0):e.next)&&!(r=r.call(e,c[1])).done)return r;switch(e=0,r&&(c=[2&c[0],r.value]),c[0]){case 0:case 1:r=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,e=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(r=i.trys,(r=r.length>0&&r[r.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!r||c[1]>r[0]&&c[1]n?o-n:n-o},o.diffDays=function(o,n){var t=o.getTime(),e=n.getTime(),r=Math.abs(t>=e?t-e:e-t);return Math.floor(r/864e5)},o.formatSeconds=function(o,n){if(!o&&!t(o,"number"))return"00:00";var e=Math.floor(o/3600),r=Math.floor(o%3600/60),c=o%60;switch(n){case"hh:mm:ss":return"".concat(e<10?"0"+e:e,":").concat(r<10?"0"+r:r,":").concat(c<10?"0"+c:c);case"mm:ss":return e?"".concat(60*e+r,":").concat(c<10?"0"+c:c):"".concat(r,":").concat(c<10?"0"+c:c);default:return e?"".concat(60*e+r,":").concat(c<10?"0"+c:c):"".concat(r<10?"0"+r:r,":").concat(c<10?"0"+c:c)}},o.getBaseUrl=function(o){return o.includes("?")?o.split("?")[0]:o},o.getCookie=a,o.getFromClipboard=function(){return new Promise((function(o,n){navigator.clipboard.readText().then((function(n){o(n)})).catch((function(o){n(o)}))}))},o.getTypeOf=n,o.getUrlParams=function(o){var n={},t=o.split("?")[1];return t?(t.split("&").forEach((function(o){var t=o.split("="),e=t[0],r=t[1];n[e]?Array.isArray(n[e])?n[e].push(r):n[e]=[n[e],r]:n[e]=r})),n):n},o.goToTop=function o(){var n,t,e,r=null!==(t=null===(n=null===document||void 0===document?void 0:document.documentElement)||void 0===n?void 0:n.scrollTop)&&void 0!==t?t:null===(e=null===document||void 0===document?void 0:document.body)||void 0===e?void 0:e.scrollTop;r>0&&(window.requestAnimationFrame(o),window.scrollTo(0,r-r/8))},o.is=t,o.isBrowser=u,o.isChinese=function(o){return/^[\u4e00-\u9fa5]+$/.test(o)},o.isEmail=function(o){return/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(o)},o.isIdCard=function(o,n){void 0===n&&(n=0);switch(n){case 1:return/^[1-9]\d{7}(?:0\d|10|11|12)(?:0[1-9]|[1-2][\d]|30|31)\d{3}$/.test(o);case 2:return/^[1-9]\d{5}(?:18|19|20)\d{2}(?:0[1-9]|10|11|12)(?:0[1-9]|[1-2]\d|30|31)\d{3}[\dXx]$/.test(o);default:return/^\d{6}((((((19|20)\d{2})(0[13-9]|1[012])(0[1-9]|[12]\d|30))|(((19|20)\d{2})(0[13578]|1[02])31)|((19|20)\d{2})02(0[1-9]|1\d|2[0-8])|((((19|20)([13579][26]|[2468][048]|0[48]))|(2000))0229))\d{3})|((((\d{2})(0[13-9]|1[012])(0[1-9]|[12]\d|30))|((\d{2})(0[13578]|1[02])31)|((\d{2})02(0[1-9]|1\d|2[0-8]))|(([13579][26]|[2468][048]|0[048])0229))\d{2}))(\d|X|x)$/.test(o)}},o.isMobile=function(o){return/^(?:(?:\+|00)86)?1(?:(?:3[\d])|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\d])|(?:9[189]))\d{8}$/.test(o)},o.isRegexWith=function(o,n){return o.test(n)},o.isUrl=function(o){return/^(((ht|f)tps?):\/\/)?([^!@#$%^&*?.\s-]([^!@#$%^&*?.\s]{0,63}[^!@#$%^&*?.\s])?\.)+[a-z]{2,6}\/?/.test(o)},o.log=l,o.randomColor=function(o){void 0===o&&(o=0);var n="rgb(".concat(f(0,255),", ").concat(f(0,255),", ").concat(f(0,255),")"),t="rgba(".concat(f(0,255),", ").concat(f(0,255),", ").concat(f(0,255),", ").concat((f(0,255)/255).toFixed(2),")"),e="hsl(".concat(f(0,360),", ").concat(f(0,100),"%, ").concat(f(0,100),"%)"),r="hsla(".concat(f(0,360),", ").concat(f(0,100),"%, ").concat(f(0,100),"%, ").concat((f(0,100)/255).toFixed(1),")"),c="#".concat(f(0,255).toString(16)).concat(f(0,255).toString(16)).concat(f(0,255).toString(16));return o?1===o?t:2===o?e:3===o?r:c:n},o.randomIP=function(o){void 0===o&&(o=0);var n=f(0,255)+"."+f(0,255)+"."+f(0,255)+"."+f(0,255),t=f(0,65535)+":"+f(0,65535)+":"+f(0,65535)+":"+f(0,65535)+":"+f(0,65535)+":"+f(0,65535)+":"+f(0,65535)+":"+f(0,65535);return o?t:n},o.randomInt=f,o.removeHTMLTag=function(o){return o.replace(/<[^>]+>/g,"")},o.sum=function(o){return o.reduce((function(o,n){return o+n}),0)},o.throttle=function(o,n){void 0===n&&(n=1e3);var t=!1;return function(){for(var e=[],r=0;r {\n const type = Object.prototype.toString.call(param).slice(8, -1);\n return type.toLowerCase();\n};\n","/**\n * @func is\n * @param {any} value\n * @param {string} type\n */\nimport { getTypeOf } from './getTypeOf';\n\nexport const is = (value: any, type: string): boolean => {\n return getTypeOf(value) === type.toLowerCase();\n}\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n","/**\n * isBrowser\n * 检测代码是否运行在浏览器环境\n */\n\nexport const isBrowser: boolean = typeof window === 'object' && typeof document === 'object';\n","import { isBrowser } from './isBrowser';\n\n/**\n * 获取cookie\n * new RegExp(`(^| )${name}=([^;]*)(;|$)`) 匹配 name=value 值\n * @param name[可选] cookie名称\n * @returns {Array | string | undefined}\n */\n\nexport const getCookie = (name?: string): Array | string | undefined => {\n // Environmental Test\n if (!isBrowser) throw new Error(\"Non-browser environment, unavailable 'getCookie'\");\n\n if (!document.cookie) throw new Error('No Cookie Found');\n\n if (name) {\n const reg = new RegExp(`(^| )${name}=([^;]*)(;|$)`);\n const arr = document.cookie.match(reg);\n return arr ? arr[2] : undefined;\n }\n\n // Get Cookies && String => Array\n return document.cookie.split(';');\n};\n","/**\n * @func log\n * @desc 📝 Logs a message to the console.\n * @example log.info('Hello world'); log.error('Oh no!');\n */\n\nexport const log = {\n info: (...args: any[]) => console.log(`%c%s`, 'color: #9E9E9E', ...args),\n error: (...args: any[]) => console.log(`%c%s`, 'color: #d81e06', ...args),\n warn: (...args: any[]) => console.log(`%c%s`, 'color: #ffc107', ...args),\n debug: (...args: any[]) => console.log(`%c%s`, 'color: #2196f3', ...args),\n success: (...args: any[]) => console.log(`%c%s`, 'color: #4caf50', ...args),\n color: (color: string) => (...args: any[]) => console.log(`%c%s`, `color: ${color}`, ...args) as any,\n};\n","/**\n * @func randomInt\n * @param {number} min - min number\n * @param {number} max - max number\n * @returns {number} - random number\n */\nexport const randomInt = (min: number, max: number): number => {\n return Math.floor(Math.random() * (max - min + 1) + min);\n}","/**\n * @func average\n * @desc 📝 计算数组的平均值\n * @param {number[]} numbers\n * @returns {number}\n * @example average([1, 2, 3, 4, 5]) // 3\n */\nexport const average = (numbers: number[]): number => {\n return numbers.reduce((acc, curr) => acc + curr, 0) / numbers.length;\n};\n","import { isBrowser } from './isBrowser';\nimport { getCookie } from './getCookie';\n/** \n * Clean Cookies\n * (/^ +/, '') 清除头部空格\n * match(/=(\\S*)/)[1] 提取cookie值\n * HttpOnly 不允许脚本读取,客户端无法操作\n */\n\nexport const clearCookie = () => {\n // Environmental Test\n if (!isBrowser) throw new Error(\"Non-browser environment, unavailable 'cleanCookies'\");\n \n if (!document.cookie) throw new Error('No Cookie Found');\n\n for (let i = 0; i < getCookie().length; i++) {\n const element = getCookie()[i];\n document.cookie = element.replace(/^ +/, '').replace(element.match(/=(\\S*)/)[1], ``);\n }\n}\n","/**\n * @version v0.0.31\n * @func coorDistance\n * @param {object} coor1 - 坐标1\n * @param {object} coor2 - 坐标2\n * @returns {number} - 距离\n * @desc 📝 计算两个坐标点之间的距离\n */\ninterface Point {\n x: number;\n y: number;\n}\n\nexport const coorDistance = (p1: Point, p2: Point): number => {\n const { x: x1, y: y1 } = p1;\n const { x: x2, y: y2 } = p2;\n return Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));\n};\n","/**\n * @func copyToClipboard\n * @desc 📝 Copy text to clipboard\n * @param {string} text\n * @returns {Promise}\n */\nexport const copyToClipboard = (text: string): Promise => {\n return new Promise((resolve, reject) => {\n const textArea = document.createElement('textarea');\n textArea.value = text;\n textArea.style.position = 'fixed';\n textArea.style.top = '0';\n textArea.style.left = '0';\n textArea.style.opacity = '0';\n document.body.appendChild(textArea);\n textArea.focus();\n textArea.select();\n try {\n // execCommand() API 已废弃⚠️\n // document.execCommand(\"copy\");\n document.queryCommandValue('copy');\n resolve();\n } catch (err) {\n reject(err);\n }\n document.body.removeChild(textArea);\n });\n};\n","/**\n * @func diffCount\n * @param {number} a\n * @param {number} b\n * @returns {number}\n * @desc 计算两个数的差值\n */\nexport const diffCount = (a: number, b: number): number => a > b ? a - b : b - a","/**\n * @func diffDays\n * @desc 📝比较两个日期相差的天数\n * @param {Date} date1\n * @param {Date} date2\n * @returns {number}\n */\nexport function diffDays(date1: Date, date2: Date): number {\n const time1 = date1.getTime();\n const time2 = date2.getTime();\n const diff = Math.abs(time1 >= time2 ? time1 - time2 : time2 - time1);\n return Math.floor(diff / (1000 * 60 * 60 * 24));\n}\n","import { is } from '../_basic/index'\n/**\n * @func formatSeconds\n * @param {number} seconds\n * @param {string} [format]\n * @returns {string} 'hh:mm:ss' | 'mm:ss'\n * @desc 📝格式化秒数, 可以指定格式, 默认为: 'mm:ss'.\n */\n\nexport function formatSeconds(seconds: number, format?: string): string {\n if (!seconds && !is(seconds, 'number')) return '00:00';\n const hh = Math.floor(seconds / 3600);\n const mm = Math.floor((seconds % 3600) / 60);\n const ss = seconds % 60;\n switch (format) {\n case 'hh:mm:ss':\n return `${hh < 10 ? '0' + hh : hh}:${mm < 10 ? '0' + mm : mm}:${ss < 10 ? '0' + ss : ss}`;\n case 'mm:ss':\n if (hh) return `${hh * 60 + mm}:${ss < 10 ? '0' + ss : ss}`;\n return `${mm}:${ss < 10 ? '0' + ss : ss}`;\n default:\n if (hh) return `${hh * 60 + mm}:${ss < 10 ? '0' + ss : ss}`;\n return `${mm < 10 ? '0' + mm : mm}:${ss < 10 ? '0' + ss : ss}`;\n }\n}\n","/**\n * @func getBaseUrl\n * @param {string} url\n * @returns {string}\n * @desc 📝 获取 ? 前面的url\n */\nexport const getBaseUrl = (url: string): string => {\n return url.includes('?') ? url.split('?')[0] : url;\n};\n","/**\n * @func getFromClipboard\n * @desc 📝 Get text from clipboard\n * @returns {Promise}\n */\nexport const getFromClipboard = (): Promise => {\n return new Promise((resolve, reject) => {\n navigator.clipboard.readText()\n .then(text => {\n resolve(text);\n })\n .catch(err => {\n reject(err);\n });\n });\n};\n","/**\n * @func getUrlParams\n * @param {string} url\n * @returns {object}\n * @desc 📝 获取 url 中所有的参数,以对象的形式返回,如果参数名重复,则以数组的形式返回\n */\nexport const getUrlParams = (url: string): object => {\n const params: { [key: string]: any } = {};\n const query = url.split('?')[1];\n if (!query) return params;\n const queryArr = query.split('&');\n queryArr.forEach((item: string) => {\n const [key, value] = item.split('=');\n if (params[key]) {\n if (Array.isArray(params[key])) {\n params[key].push(value);\n } else {\n params[key] = [params[key], value];\n }\n } else {\n params[key] = value;\n }\n });\n return params;\n}","/**\n * @version v0.0.31\n * @func goToTop\n * @return {void}\n * @desc 📝 平滑滚动到顶部\n */\nexport const goToTop = (): void => {\n const c = document?.documentElement?.scrollTop ?? document?.body?.scrollTop;\n if (c > 0) {\n window.requestAnimationFrame(goToTop);\n window.scrollTo(0, c - c / 8);\n }\n}\n","/**\n * 是否是中文\n * @param str 字符串\n * @returns {boolean}\n * @description Returns true if the string is a chinese.\n */\nexport const isChinese = (str: string): boolean => {\n const reg = /^[\\u4e00-\\u9fa5]+$/;\n return reg.test(str);\n};\n","/**\n * 是否是邮箱\n * @param {string} str\n * @returns {boolean}\n * @description Returns true if the string is a email.\n */\n\nexport const isEmail = (str: string): boolean => {\n const reg =\n /^(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n return reg.test(str);\n};\n","/**\n * 是否为身份证号: 支持(1/2)代,15位或18位\n * @param {string} str 身份证号\n * @param {number} type 1:15位,2:18位,默认0 同时匹配15位和18位\n * @returns {boolean}\n * @description Returns true if the string is a id card.\n */\nexport const isIdCard = (str: string, type: number = 0): boolean => {\n // 1代身份证\n const reg1 = /^[1-9]\\d{7}(?:0\\d|10|11|12)(?:0[1-9]|[1-2][\\d]|30|31)\\d{3}$/;\n // 2代身份证\n const reg2 = /^[1-9]\\d{5}(?:18|19|20)\\d{2}(?:0[1-9]|10|11|12)(?:0[1-9]|[1-2]\\d|30|31)\\d{3}[\\dXx]$/;\n const reg =\n /^\\d{6}((((((19|20)\\d{2})(0[13-9]|1[012])(0[1-9]|[12]\\d|30))|(((19|20)\\d{2})(0[13578]|1[02])31)|((19|20)\\d{2})02(0[1-9]|1\\d|2[0-8])|((((19|20)([13579][26]|[2468][048]|0[48]))|(2000))0229))\\d{3})|((((\\d{2})(0[13-9]|1[012])(0[1-9]|[12]\\d|30))|((\\d{2})(0[13578]|1[02])31)|((\\d{2})02(0[1-9]|1\\d|2[0-8]))|(([13579][26]|[2468][048]|0[048])0229))\\d{2}))(\\d|X|x)$/;\n\n switch (type) {\n case 1:\n return reg1.test(str);\n case 2:\n return reg2.test(str);\n default:\n return reg.test(str);\n }\n};\n","/**\n * @param {string} str\n * @returns {boolean}\n * @description Returns true if the string is a mobile phone number.\n */\nexport const isMobile = (str: string): boolean => {\n const reg = /^(?:(?:\\+|00)86)?1(?:(?:3[\\d])|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\\d])|(?:9[189]))\\d{8}$/;\n return reg.test(str);\n}\n","/**\n * 自定义正则表达式\n * @param {RegExp} regex 正则表达式\n * @param {string} str 字符串\n * @returns {boolean}\n */\n\nexport const isRegexWith = (regex: RegExp, str: string): boolean => regex.test(str);\n","/**\n * 是否是url\n * @param {string} str\n * @returns {boolean}\n * @description Returns true if the string is a url.\n */\nexport const isUrl = (str: string): boolean => {\n const reg = /^(((ht|f)tps?):\\/\\/)?([^!@#$%^&*?.\\s-]([^!@#$%^&*?.\\s]{0,63}[^!@#$%^&*?.\\s])?\\.)+[a-z]{2,6}\\/?/;\n return reg.test(str);\n};\n","import { randomInt } from './randomInt';\n/**\n * @func randomColor\n * @param {type} type - 0: rgb, 1: rgba, 2: hsl, 3: hsla, 4: hex\n * @returns {string} - random color\n * @desc 📝生成一个随机的颜色值\n */\n\nexport const randomColor = (type: number = 0): string => {\n const rgb = `rgb(${randomInt(0, 255)}, ${randomInt(0, 255)}, ${randomInt(0, 255)})`;\n const rgba = `rgba(${randomInt(0, 255)}, ${randomInt(0, 255)}, ${randomInt(0, 255)}, ${(\n randomInt(0, 255) / 255.0\n ).toFixed(2)})`;\n const hsl = `hsl(${randomInt(0, 360)}, ${randomInt(0, 100)}%, ${randomInt(0, 100)}%)`;\n const hsla = `hsla(${randomInt(0, 360)}, ${randomInt(0, 100)}%, ${randomInt(0, 100)}%, ${(\n randomInt(0, 100) / 255.0\n ).toFixed(1)})`;\n const hex = `#${randomInt(0, 255).toString(16)}${randomInt(0, 255).toString(16)}${randomInt(0, 255).toString(16)}`;\n return type ? (type === 1 ? rgba : type === 2 ? hsl : type === 3 ? hsla : hex) : rgb;\n};\n","import { randomInt } from './randomInt'\n\n/**\n * @func randomIP\n * @param {number} type - 0: ipv4, 1: ipv6\n * @returns {string} - random ip address\n * @desc 生成一个随机的IP地址,可以是IPv4或者IPv6\n */\n\nexport const randomIP = (type: number = 0): string => {\n const ipv4 = randomInt(0, 255) + '.' + randomInt(0, 255) + '.' + randomInt(0, 255) + '.' + randomInt(0, 255);\n const ipv6 =\n randomInt(0, 65535) +\n ':' +\n randomInt(0, 65535) +\n ':' +\n randomInt(0, 65535) +\n ':' +\n randomInt(0, 65535) +\n ':' +\n randomInt(0, 65535) +\n ':' +\n randomInt(0, 65535) +\n ':' +\n randomInt(0, 65535) +\n ':' +\n randomInt(0, 65535);\n return type ? ipv6 : ipv4;\n};\n","/**\n * @func removeHTMLTag\n * @param {string} str\n * @return {string}\n * @desc 📝 去掉文本中所有标签,只保留文本\n */\nexport const removeHTMLTag = (str: string): string => str.replace(/<[^>]+>/g, '');\n","/**\n * @func sum\n * @desc 📝 计算数组的和\n * @param {number[]} numbers\n * @returns {number}\n */\nexport const sum = (numbers: number[]): number => {\n return numbers.reduce((acc, curr) => acc + curr, 0);\n};\n","/**\n * @func throttle\n * @desc 📝 函数节流,每隔一段时间执行一次,防止函数过于频繁调用,导致性能问题\n * @param {Function} fn\n * @param {number} [ms=1000]\n * @returns {Function}\n */\nexport const throttle = (fn: Function, ms: number = 1000): Function => {\n let isRunning = false;\n return (...args: any[]) => {\n if (isRunning) return;\n isRunning = true;\n setTimeout(() => {\n fn(...args);\n isRunning = false;\n }, ms);\n }\n}","/**\n * wait\n * @param {number} milliseconds\n */\nexport const wait = async (milliseconds: number) => new Promise(resolve => setTimeout(resolve, milliseconds));\n"],"names":["getTypeOf","param","type","Object","prototype","toString","call","slice","toLowerCase","is","value","__awaiter","thisArg","_arguments","P","generator","Promise","resolve","reject","fulfilled","step","next","e","rejected","result","done","then","apply","__generator","body","f","y","t","g","_","label","sent","trys","ops","verb","throw","return","Symbol","iterator","this","n","v","op","TypeError","pop","length","push","__spreadArray","to","from","pack","arguments","ar","i","l","Array","concat","isBrowser","window","document","getCookie","name","Error","cookie","reg","RegExp","arr","match","undefined","split","log","info","args","_i","console","error","warn","debug","success","color","randomInt","min","max","Math","floor","random","numbers","reduce","acc","curr","element","replace","p1","p2","x1","x","y1","x2","y2","sqrt","pow","text","textArea","createElement","style","position","top","left","opacity","appendChild","focus","select","queryCommandValue","err","removeChild","a","b","date1","date2","time1","getTime","time2","diff","abs","seconds","format","hh","mm","ss","url","includes","navigator","clipboard","readText","params","query","forEach","item","_a","key","isArray","goToTop","c","_b","documentElement","scrollTop","_c","requestAnimationFrame","scrollTo","str","test","regex","rgb","rgba","toFixed","hsl","hsla","hex","ipv4","ipv6","fn","ms","isRunning","setTimeout","milliseconds"],"mappings":"kPAMaA,EAAY,SAACC,GAEjBC,OADMC,OAAOC,UAAUC,SAASC,KAAKL,GAAOM,MAAM,GAAI,GACjDC,eCDDC,EAAK,SAACC,EAAYR,GACtBF,OAAAA,EAAUU,KAAWR,EAAKM;;;;;;;;;;;;;;;AC6D5B,SAASG,EAAUC,EAASC,EAAYC,EAAGC,GAE9C,OAAO,IAAKD,IAAMA,EAAIE,WAAU,SAAUC,EAASC,GAC/C,SAASC,EAAUT,GAAS,IAAMU,EAAKL,EAAUM,KAAKX,IAAW,MAAOY,GAAKJ,EAAOI,IACpF,SAASC,EAASb,GAAS,IAAMU,EAAKL,EAAiB,MAAEL,IAAW,MAAOY,GAAKJ,EAAOI,IACvF,SAASF,EAAKI,GAJlB,IAAed,EAIac,EAAOC,KAAOR,EAAQO,EAAOd,QAJ1CA,EAIyDc,EAAOd,MAJhDA,aAAiBI,EAAIJ,EAAQ,IAAII,GAAE,SAAUG,GAAWA,EAAQP,OAITgB,KAAKP,EAAWI,GAClGH,GAAML,EAAYA,EAAUY,MAAMf,EAASC,GAAc,KAAKQ,WAI/D,SAASO,EAAYhB,EAASiB,GACjC,IAAsGC,EAAGC,EAAGC,EAAGC,EAA3GC,EAAI,CAAEC,MAAO,EAAGC,KAAM,WAAa,GAAW,EAAPJ,EAAE,GAAQ,MAAMA,EAAE,GAAI,OAAOA,EAAE,IAAOK,KAAM,GAAIC,IAAK,IAChG,OAAOL,EAAI,CAAEZ,KAAMkB,EAAK,GAAIC,MAASD,EAAK,GAAIE,OAAUF,EAAK,IAAwB,mBAAXG,SAA0BT,EAAES,OAAOC,UAAY,WAAa,OAAOC,OAAUX,EACvJ,SAASM,EAAKM,GAAK,O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AAU,EAAG,KAAKhF,SAAS,KACtGH,OAAAA,EAAiB,IAATA,EAAa4J,EAAgB,IAAT5J,EAAa8J,EAAe,IAAT9J,EAAa+J,EAAOC,EAAOL,cCT3D,SAAC3J,QAAA,IAAAA,IAAAA,EAAgB,GACrC,IAAMiK,EAAO9E,EAAU,EAAG,KAAO,IAAMA,EAAU,EAAG,KAAO,IAAMA,EAAU,EAAG,KAAO,IAAMA,EAAU,EAAG,KAClG+E,EACJ/E,EAAU,EAAG,OACb,IACAA,EAAU,EAAG,OACb,IACAA,EAAU,EAAG,OACb,IACAA,EAAU,EAAG,OACb,IACAA,EAAU,EAAG,OACb,IACAA,EAAU,EAAG,OACb,IACAA,EAAU,EAAG,OACb,IACAA,EAAU,EAAG,OACf,OAAOnF,EAAOkK,EAAOD,iCCrBI,SAACT,GAAwB,OAAAA,EAAI1D,QAAQ,WAAY,WCA3D,SAACL,GACVA,OAAAA,EAAQC,QAAO,SAACC,EAAKC,GAASD,OAAAA,EAAMC,IAAM,eCA5B,SAACuE,EAAcC,QAAA,IAAAA,IAAAA,EAAiB,KAClDC,IAAAA,GAAY,EAChB,OAAO,eAAe1F,IAAAA,EAAA,GAAAC,EAAA,EAAdA,EAActB,UAAAN,OAAd4B,IAAAD,EAAcC,GAAAtB,UAAAsB,GAChByF,IACJA,GAAY,EACZC,YAAW,WACTH,EAAE1I,WAAA,EAAIkD,GACN0F,GAAY,IACXD,aCXa,SAAOG,GAAoB9J,OAAAA,OAAA,OAAA,OAAA,GAAA,WAAA,OAAAiB,EAAAgB,MAAA,SAAAmG,GAAK,MAAA,CAAA,EAAA,IAAI/H,SAAQ,SAAAC,GAAW,OAAAuJ,WAAWvJ,EAASwJ"}
--------------------------------------------------------------------------------
/lib/index.min.mjs:
--------------------------------------------------------------------------------
1 | var n=function(n){return Object.prototype.toString.call(n).slice(8,-1).toLowerCase()},o=function(o,t){return n(o)===t.toLowerCase()};
2 | /*! *****************************************************************************
3 | Copyright (c) Microsoft Corporation.
4 |
5 | Permission to use, copy, modify, and/or distribute this software for any
6 | purpose with or without fee is hereby granted.
7 |
8 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
9 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10 | AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
11 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12 | LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13 | OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14 | PERFORMANCE OF THIS SOFTWARE.
15 | ***************************************************************************** */
16 | function t(n,o,t,e){return new(t||(t=Promise))((function(r,c){function u(n){try{a(e.next(n))}catch(n){c(n)}}function i(n){try{a(e.throw(n))}catch(n){c(n)}}function a(n){var o;n.done?r(n.value):(o=n.value,o instanceof t?o:new t((function(n){n(o)}))).then(u,i)}a((e=e.apply(n,o||[])).next())}))}function e(n,o){var t,e,r,c,u={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return c={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(c[Symbol.iterator]=function(){return this}),c;function i(c){return function(i){return function(c){if(t)throw new TypeError("Generator is already executing.");for(;u;)try{if(t=1,e&&(r=2&c[0]?e.return:c[0]?e.throw||((r=e.return)&&r.call(e),0):e.next)&&!(r=r.call(e,c[1])).done)return r;switch(e=0,r&&(c=[2&c[0],r.value]),c[0]){case 0:case 1:r=c;break;case 4:return u.label++,{value:c[1],done:!1};case 5:u.label++,e=c[1],c=[0];continue;case 7:c=u.ops.pop(),u.trys.pop();continue;default:if(!(r=u.trys,(r=r.length>0&&r[r.length-1])||6!==c[0]&&2!==c[0])){u=0;continue}if(3===c[0]&&(!r||c[1]>r[0]&&c[1]]+>/g,"")};function f(n){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},f(n)}var s="object"===("undefined"==typeof window?"undefined":f(window))&&"object"===("undefined"==typeof document?"undefined":f(document)),d=function(n){if(!s)throw new Error("Non-browser environment, unavailable 'getCookie'");if(!document.cookie)throw new Error("No Cookie Found");if(n){var o=new RegExp("(^| )".concat(n,"=([^;]*)(;|$)")),t=document.cookie.match(o);return t?t[2]:void 0}return document.cookie.split(";")},p=function(){if(!s)throw new Error("Non-browser environment, unavailable 'cleanCookies'");if(!document.cookie)throw new Error("No Cookie Found");for(var n=0;n0&&(window.requestAnimationFrame(n),window.scrollTo(0,r-r/8))},m={info:function(){for(var n=[],o=0;oo?n-o:o-n},x=function(n,o){var t=n.x,e=n.y,r=o.x,c=o.y;return Math.sqrt(Math.pow(r-t,2)+Math.pow(c-e,2))},k=function(n){return/^(?:(?:\+|00)86)?1(?:(?:3[\d])|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\d])|(?:9[189]))\d{8}$/.test(n)},E=function(n,o){return n.test(o)},S=function(n){return/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(n)},$=function(n){return/^(((ht|f)tps?):\/\/)?([^!@#$%^&*?.\s-]([^!@#$%^&*?.\s]{0,63}[^!@#$%^&*?.\s])?\.)+[a-z]{2,6}\/?/.test(n)},C=function(n){return/^[\u4e00-\u9fa5]+$/.test(n)},M=function(n,o){void 0===o&&(o=0);switch(o){case 1:return/^[1-9]\d{7}(?:0\d|10|11|12)(?:0[1-9]|[1-2][\d]|30|31)\d{3}$/.test(n);case 2:return/^[1-9]\d{5}(?:18|19|20)\d{2}(?:0[1-9]|10|11|12)(?:0[1-9]|[1-2]\d|30|31)\d{3}[\dXx]$/.test(n);default:return/^\d{6}((((((19|20)\d{2})(0[13-9]|1[012])(0[1-9]|[12]\d|30))|(((19|20)\d{2})(0[13578]|1[02])31)|((19|20)\d{2})02(0[1-9]|1\d|2[0-8])|((((19|20)([13579][26]|[2468][048]|0[48]))|(2000))0229))\d{3})|((((\d{2})(0[13-9]|1[012])(0[1-9]|[12]\d|30))|((\d{2})(0[13578]|1[02])31)|((\d{2})02(0[1-9]|1\d|2[0-8]))|(([13579][26]|[2468][048]|0[048])0229))\d{2}))(\d|X|x)$/.test(n)}};function T(n,o){var t=n.getTime(),e=o.getTime(),r=Math.abs(t>=e?t-e:e-t);return Math.floor(r/864e5)}function A(n,t){if(!n&&!o(n,"number"))return"00:00";var e=Math.floor(n/3600),r=Math.floor(n%3600/60),c=n%60;switch(t){case"hh:mm:ss":return"".concat(e<10?"0"+e:e,":").concat(r<10?"0"+r:r,":").concat(c<10?"0"+c:c);case"mm:ss":return e?"".concat(60*e+r,":").concat(c<10?"0"+c:c):"".concat(r,":").concat(c<10?"0"+c:c);default:return e?"".concat(60*e+r,":").concat(c<10?"0"+c:c):"".concat(r<10?"0"+r:r,":").concat(c<10?"0"+c:c)}}var F=function(n,o){return Math.floor(Math.random()*(o-n+1)+n)},N=function(n){void 0===n&&(n=0);var o=F(0,255)+"."+F(0,255)+"."+F(0,255)+"."+F(0,255),t=F(0,65535)+":"+F(0,65535)+":"+F(0,65535)+":"+F(0,65535)+":"+F(0,65535)+":"+F(0,65535)+":"+F(0,65535)+":"+F(0,65535);return n?t:o},P=function(n){void 0===n&&(n=0);var o="rgb(".concat(F(0,255),", ").concat(F(0,255),", ").concat(F(0,255),")"),t="rgba(".concat(F(0,255),", ").concat(F(0,255),", ").concat(F(0,255),", ").concat((F(0,255)/255).toFixed(2),")"),e="hsl(".concat(F(0,360),", ").concat(F(0,100),"%, ").concat(F(0,100),"%)"),r="hsla(".concat(F(0,360),", ").concat(F(0,100),"%, ").concat(F(0,100),"%, ").concat((F(0,100)/255).toFixed(1),")"),c="#".concat(F(0,255).toString(16)).concat(F(0,255).toString(16)).concat(F(0,255).toString(16));return n?1===n?t:2===n?e:3===n?r:c:o};export{w as average,p as clearCookie,x as coorDistance,u as copyToClipboard,g as diffCount,T as diffDays,A as formatSeconds,v as getBaseUrl,d as getCookie,i as getFromClipboard,n as getTypeOf,h as getUrlParams,y as goToTop,o as is,s as isBrowser,C as isChinese,S as isEmail,M as isIdCard,k as isMobile,E as isRegexWith,$ as isUrl,m as log,P as randomColor,N as randomIP,F as randomInt,l as removeHTMLTag,b as sum,a as throttle,c as wait};
17 | //# sourceMappingURL=index.min.mjs.map
18 |
--------------------------------------------------------------------------------
/lib/index.min.mjs.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"index.min.mjs","sources":["../_basic/getTypeOf.ts","../_basic/is.ts","../node_modules/.pnpm/tslib@2.3.1/node_modules/tslib/tslib.es6.js","../_basic/wait.ts","../_basic/copyToClipboard.ts","../_basic/getFromClipboard.ts","../_basic/throttle.ts","../_basic/removeHTMLTag.ts","../_browser/isBrowser.ts","../_browser/getCookie.ts","../_browser/clearCookie.ts","../_browser/getBaseUrl.ts","../_browser/getUrlParams.ts","../_browser/goToTop.ts","../_browser/log.ts","../_calc/average.ts","../_calc/sum.ts","../_calc/diffCount.ts","../_calc/coorDistance.ts","../_regex/isMobile.ts","../_regex/isRegexWith.ts","../_regex/isEmail.ts","../_regex/isUrl.ts","../_regex/isChinese.ts","../_regex/isIdCard.ts","../_time/diffDays.ts","../_time/formatSeconds.ts","../_random/randomInt.ts","../_random/randomIP.ts","../_random/randomColor.ts"],"sourcesContent":["/**\n * @param {unknown} param\n * @returns {string}\n * String, Number, Boolean, Symbol, Null, Undefined, Object\n * Array, RegExp, Date, Error, Function, AsyncFunction, HTMLDocument\n */\nexport const getTypeOf = (param: unknown): string => {\n const type = Object.prototype.toString.call(param).slice(8, -1);\n return type.toLowerCase();\n};\n","/**\n * @func is\n * @param {any} value\n * @param {string} type\n */\nimport { getTypeOf } from './getTypeOf';\n\nexport const is = (value: any, type: string): boolean => {\n return getTypeOf(value) === type.toLowerCase();\n}\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n","/**\n * wait\n * @param {number} milliseconds\n */\nexport const wait = async (milliseconds: number) => new Promise(resolve => setTimeout(resolve, milliseconds));\n","/**\n * @func copyToClipboard\n * @desc 📝 Copy text to clipboard\n * @param {string} text\n * @returns {Promise}\n */\nexport const copyToClipboard = (text: string): Promise => {\n return new Promise((resolve, reject) => {\n const textArea = document.createElement('textarea');\n textArea.value = text;\n textArea.style.position = 'fixed';\n textArea.style.top = '0';\n textArea.style.left = '0';\n textArea.style.opacity = '0';\n document.body.appendChild(textArea);\n textArea.focus();\n textArea.select();\n try {\n // execCommand() API 已废弃⚠️\n // document.execCommand(\"copy\");\n document.queryCommandValue('copy');\n resolve();\n } catch (err) {\n reject(err);\n }\n document.body.removeChild(textArea);\n });\n};\n","/**\n * @func getFromClipboard\n * @desc 📝 Get text from clipboard\n * @returns {Promise}\n */\nexport const getFromClipboard = (): Promise => {\n return new Promise((resolve, reject) => {\n navigator.clipboard.readText()\n .then(text => {\n resolve(text);\n })\n .catch(err => {\n reject(err);\n });\n });\n};\n","/**\n * @func throttle\n * @desc 📝 函数节流,每隔一段时间执行一次,防止函数过于频繁调用,导致性能问题\n * @param {Function} fn\n * @param {number} [ms=1000]\n * @returns {Function}\n */\nexport const throttle = (fn: Function, ms: number = 1000): Function => {\n let isRunning = false;\n return (...args: any[]) => {\n if (isRunning) return;\n isRunning = true;\n setTimeout(() => {\n fn(...args);\n isRunning = false;\n }, ms);\n }\n}","/**\n * @func removeHTMLTag\n * @param {string} str\n * @return {string}\n * @desc 📝 去掉文本中所有标签,只保留文本\n */\nexport const removeHTMLTag = (str: string): string => str.replace(/<[^>]+>/g, '');\n","/**\n * isBrowser\n * 检测代码是否运行在浏览器环境\n */\n\nexport const isBrowser: boolean = typeof window === 'object' && typeof document === 'object';\n","import { isBrowser } from './isBrowser';\n\n/**\n * 获取cookie\n * new RegExp(`(^| )${name}=([^;]*)(;|$)`) 匹配 name=value 值\n * @param name[可选] cookie名称\n * @returns {Array | string | undefined}\n */\n\nexport const getCookie = (name?: string): Array | string | undefined => {\n // Environmental Test\n if (!isBrowser) throw new Error(\"Non-browser environment, unavailable 'getCookie'\");\n\n if (!document.cookie) throw new Error('No Cookie Found');\n\n if (name) {\n const reg = new RegExp(`(^| )${name}=([^;]*)(;|$)`);\n const arr = document.cookie.match(reg);\n return arr ? arr[2] : undefined;\n }\n\n // Get Cookies && String => Array\n return document.cookie.split(';');\n};\n","import { isBrowser } from './isBrowser';\nimport { getCookie } from './getCookie';\n/** \n * Clean Cookies\n * (/^ +/, '') 清除头部空格\n * match(/=(\\S*)/)[1] 提取cookie值\n * HttpOnly 不允许脚本读取,客户端无法操作\n */\n\nexport const clearCookie = () => {\n // Environmental Test\n if (!isBrowser) throw new Error(\"Non-browser environment, unavailable 'cleanCookies'\");\n \n if (!document.cookie) throw new Error('No Cookie Found');\n\n for (let i = 0; i < getCookie().length; i++) {\n const element = getCookie()[i];\n document.cookie = element.replace(/^ +/, '').replace(element.match(/=(\\S*)/)[1], ``);\n }\n}\n","/**\n * @func getBaseUrl\n * @param {string} url\n * @returns {string}\n * @desc 📝 获取 ? 前面的url\n */\nexport const getBaseUrl = (url: string): string => {\n return url.includes('?') ? url.split('?')[0] : url;\n};\n","/**\n * @func getUrlParams\n * @param {string} url\n * @returns {object}\n * @desc 📝 获取 url 中所有的参数,以对象的形式返回,如果参数名重复,则以数组的形式返回\n */\nexport const getUrlParams = (url: string): object => {\n const params: { [key: string]: any } = {};\n const query = url.split('?')[1];\n if (!query) return params;\n const queryArr = query.split('&');\n queryArr.forEach((item: string) => {\n const [key, value] = item.split('=');\n if (params[key]) {\n if (Array.isArray(params[key])) {\n params[key].push(value);\n } else {\n params[key] = [params[key], value];\n }\n } else {\n params[key] = value;\n }\n });\n return params;\n}","/**\n * @version v0.0.31\n * @func goToTop\n * @return {void}\n * @desc 📝 平滑滚动到顶部\n */\nexport const goToTop = (): void => {\n const c = document?.documentElement?.scrollTop ?? document?.body?.scrollTop;\n if (c > 0) {\n window.requestAnimationFrame(goToTop);\n window.scrollTo(0, c - c / 8);\n }\n}\n","/**\n * @func log\n * @desc 📝 Logs a message to the console.\n * @example log.info('Hello world'); log.error('Oh no!');\n */\n\nexport const log = {\n info: (...args: any[]) => console.log(`%c%s`, 'color: #9E9E9E', ...args),\n error: (...args: any[]) => console.log(`%c%s`, 'color: #d81e06', ...args),\n warn: (...args: any[]) => console.log(`%c%s`, 'color: #ffc107', ...args),\n debug: (...args: any[]) => console.log(`%c%s`, 'color: #2196f3', ...args),\n success: (...args: any[]) => console.log(`%c%s`, 'color: #4caf50', ...args),\n color: (color: string) => (...args: any[]) => console.log(`%c%s`, `color: ${color}`, ...args) as any,\n};\n","/**\n * @func average\n * @desc 📝 计算数组的平均值\n * @param {number[]} numbers\n * @returns {number}\n * @example average([1, 2, 3, 4, 5]) // 3\n */\nexport const average = (numbers: number[]): number => {\n return numbers.reduce((acc, curr) => acc + curr, 0) / numbers.length;\n};\n","/**\n * @func sum\n * @desc 📝 计算数组的和\n * @param {number[]} numbers\n * @returns {number}\n */\nexport const sum = (numbers: number[]): number => {\n return numbers.reduce((acc, curr) => acc + curr, 0);\n};\n","/**\n * @func diffCount\n * @param {number} a\n * @param {number} b\n * @returns {number}\n * @desc 计算两个数的差值\n */\nexport const diffCount = (a: number, b: number): number => a > b ? a - b : b - a","/**\n * @version v0.0.31\n * @func coorDistance\n * @param {object} coor1 - 坐标1\n * @param {object} coor2 - 坐标2\n * @returns {number} - 距离\n * @desc 📝 计算两个坐标点之间的距离\n */\ninterface Point {\n x: number;\n y: number;\n}\n\nexport const coorDistance = (p1: Point, p2: Point): number => {\n const { x: x1, y: y1 } = p1;\n const { x: x2, y: y2 } = p2;\n return Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));\n};\n","/**\n * @param {string} str\n * @returns {boolean}\n * @description Returns true if the string is a mobile phone number.\n */\nexport const isMobile = (str: string): boolean => {\n const reg = /^(?:(?:\\+|00)86)?1(?:(?:3[\\d])|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\\d])|(?:9[189]))\\d{8}$/;\n return reg.test(str);\n}\n","/**\n * 自定义正则表达式\n * @param {RegExp} regex 正则表达式\n * @param {string} str 字符串\n * @returns {boolean}\n */\n\nexport const isRegexWith = (regex: RegExp, str: string): boolean => regex.test(str);\n","/**\n * 是否是邮箱\n * @param {string} str\n * @returns {boolean}\n * @description Returns true if the string is a email.\n */\n\nexport const isEmail = (str: string): boolean => {\n const reg =\n /^(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n return reg.test(str);\n};\n","/**\n * 是否是url\n * @param {string} str\n * @returns {boolean}\n * @description Returns true if the string is a url.\n */\nexport const isUrl = (str: string): boolean => {\n const reg = /^(((ht|f)tps?):\\/\\/)?([^!@#$%^&*?.\\s-]([^!@#$%^&*?.\\s]{0,63}[^!@#$%^&*?.\\s])?\\.)+[a-z]{2,6}\\/?/;\n return reg.test(str);\n};\n","/**\n * 是否是中文\n * @param str 字符串\n * @returns {boolean}\n * @description Returns true if the string is a chinese.\n */\nexport const isChinese = (str: string): boolean => {\n const reg = /^[\\u4e00-\\u9fa5]+$/;\n return reg.test(str);\n};\n","/**\n * 是否为身份证号: 支持(1/2)代,15位或18位\n * @param {string} str 身份证号\n * @param {number} type 1:15位,2:18位,默认0 同时匹配15位和18位\n * @returns {boolean}\n * @description Returns true if the string is a id card.\n */\nexport const isIdCard = (str: string, type: number = 0): boolean => {\n // 1代身份证\n const reg1 = /^[1-9]\\d{7}(?:0\\d|10|11|12)(?:0[1-9]|[1-2][\\d]|30|31)\\d{3}$/;\n // 2代身份证\n const reg2 = /^[1-9]\\d{5}(?:18|19|20)\\d{2}(?:0[1-9]|10|11|12)(?:0[1-9]|[1-2]\\d|30|31)\\d{3}[\\dXx]$/;\n const reg =\n /^\\d{6}((((((19|20)\\d{2})(0[13-9]|1[012])(0[1-9]|[12]\\d|30))|(((19|20)\\d{2})(0[13578]|1[02])31)|((19|20)\\d{2})02(0[1-9]|1\\d|2[0-8])|((((19|20)([13579][26]|[2468][048]|0[48]))|(2000))0229))\\d{3})|((((\\d{2})(0[13-9]|1[012])(0[1-9]|[12]\\d|30))|((\\d{2})(0[13578]|1[02])31)|((\\d{2})02(0[1-9]|1\\d|2[0-8]))|(([13579][26]|[2468][048]|0[048])0229))\\d{2}))(\\d|X|x)$/;\n\n switch (type) {\n case 1:\n return reg1.test(str);\n case 2:\n return reg2.test(str);\n default:\n return reg.test(str);\n }\n};\n","/**\n * @func diffDays\n * @desc 📝比较两个日期相差的天数\n * @param {Date} date1\n * @param {Date} date2\n * @returns {number}\n */\nexport function diffDays(date1: Date, date2: Date): number {\n const time1 = date1.getTime();\n const time2 = date2.getTime();\n const diff = Math.abs(time1 >= time2 ? time1 - time2 : time2 - time1);\n return Math.floor(diff / (1000 * 60 * 60 * 24));\n}\n","import { is } from '../_basic/index'\n/**\n * @func formatSeconds\n * @param {number} seconds\n * @param {string} [format]\n * @returns {string} 'hh:mm:ss' | 'mm:ss'\n * @desc 📝格式化秒数, 可以指定格式, 默认为: 'mm:ss'.\n */\n\nexport function formatSeconds(seconds: number, format?: string): string {\n if (!seconds && !is(seconds, 'number')) return '00:00';\n const hh = Math.floor(seconds / 3600);\n const mm = Math.floor((seconds % 3600) / 60);\n const ss = seconds % 60;\n switch (format) {\n case 'hh:mm:ss':\n return `${hh < 10 ? '0' + hh : hh}:${mm < 10 ? '0' + mm : mm}:${ss < 10 ? '0' + ss : ss}`;\n case 'mm:ss':\n if (hh) return `${hh * 60 + mm}:${ss < 10 ? '0' + ss : ss}`;\n return `${mm}:${ss < 10 ? '0' + ss : ss}`;\n default:\n if (hh) return `${hh * 60 + mm}:${ss < 10 ? '0' + ss : ss}`;\n return `${mm < 10 ? '0' + mm : mm}:${ss < 10 ? '0' + ss : ss}`;\n }\n}\n","/**\n * @func randomInt\n * @param {number} min - min number\n * @param {number} max - max number\n * @returns {number} - random number\n */\nexport const randomInt = (min: number, max: number): number => {\n return Math.floor(Math.random() * (max - min + 1) + min);\n}","import { randomInt } from './randomInt'\n\n/**\n * @func randomIP\n * @param {number} type - 0: ipv4, 1: ipv6\n * @returns {string} - random ip address\n * @desc 生成一个随机的IP地址,可以是IPv4或者IPv6\n */\n\nexport const randomIP = (type: number = 0): string => {\n const ipv4 = randomInt(0, 255) + '.' + randomInt(0, 255) + '.' + randomInt(0, 255) + '.' + randomInt(0, 255);\n const ipv6 =\n randomInt(0, 65535) +\n ':' +\n randomInt(0, 65535) +\n ':' +\n randomInt(0, 65535) +\n ':' +\n randomInt(0, 65535) +\n ':' +\n randomInt(0, 65535) +\n ':' +\n randomInt(0, 65535) +\n ':' +\n randomInt(0, 65535) +\n ':' +\n randomInt(0, 65535);\n return type ? ipv6 : ipv4;\n};\n","import { randomInt } from './randomInt';\n/**\n * @func randomColor\n * @param {type} type - 0: rgb, 1: rgba, 2: hsl, 3: hsla, 4: hex\n * @returns {string} - random color\n * @desc 📝生成一个随机的颜色值\n */\n\nexport const randomColor = (type: number = 0): string => {\n const rgb = `rgb(${randomInt(0, 255)}, ${randomInt(0, 255)}, ${randomInt(0, 255)})`;\n const rgba = `rgba(${randomInt(0, 255)}, ${randomInt(0, 255)}, ${randomInt(0, 255)}, ${(\n randomInt(0, 255) / 255.0\n ).toFixed(2)})`;\n const hsl = `hsl(${randomInt(0, 360)}, ${randomInt(0, 100)}%, ${randomInt(0, 100)}%)`;\n const hsla = `hsla(${randomInt(0, 360)}, ${randomInt(0, 100)}%, ${randomInt(0, 100)}%, ${(\n randomInt(0, 100) / 255.0\n ).toFixed(1)})`;\n const hex = `#${randomInt(0, 255).toString(16)}${randomInt(0, 255).toString(16)}${randomInt(0, 255).toString(16)}`;\n return type ? (type === 1 ? rgba : type === 2 ? hsl : type === 3 ? hsla : hex) : rgb;\n};\n"],"names":["getTypeOf","param","type","Object","prototype","toString","call","slice","toLowerCase","is","value","__awaiter","thisArg","_arguments","P","generator","Promise","resolve","reject","fulfilled","step","next","e","rejected","result","done","then","apply","__generator","body","f","y","t","g","_","label","sent","trys","ops","verb","throw","return","Symbol","iterator","this","n","v","op","TypeError","pop","length","push","__spreadArray","to","from","pack","arguments","ar","i","l","Array","concat","wait","milliseconds","_a","setTimeout","copyToClipboard","text","textArea","document","createElement","style","position","top","left","opacity","appendChild","focus","select","queryCommandValue","err","removeChild","getFromClipboard","navigator","clipboard","readText","throttle","fn","ms","isRunning","args","_i","removeHTMLTag","str","replace","isBrowser","window","getCookie","name","Error","cookie","reg","RegExp","arr","match","undefined","split","clearCookie","element","getBaseUrl","url","includes","getUrlParams","params","query","forEach","item","key","isArray","goToTop","c","_b","documentElement","scrollTop","_c","requestAnimationFrame","scrollTo","log","info","console","error","warn","debug","success","color","average","numbers","reduce","acc","curr","sum","diffCount","a","b","coorDistance","p1","p2","x1","x","y1","x2","y2","Math","sqrt","pow","isMobile","test","isRegexWith","regex","isEmail","isUrl","isChinese","isIdCard","diffDays","date1","date2","time1","getTime","time2","diff","abs","floor","formatSeconds","seconds","format","hh","mm","ss","randomInt","min","max","random","randomIP","ipv4","ipv6","randomColor","rgb","rgba","toFixed","hsl","hsla","hex"],"mappings":"IAMaA,EAAY,SAACC,GAEjBC,OADMC,OAAOC,UAAUC,SAASC,KAAKL,GAAOM,MAAM,GAAI,GACjDC,eCDDC,EAAK,SAACC,EAAYR,GACtBF,OAAAA,EAAUU,KAAWR,EAAKM;;;;;;;;;;;;;;;AC6D5B,SAASG,EAAUC,EAASC,EAAYC,EAAGC,GAE9C,OAAO,IAAKD,IAAMA,EAAIE,WAAU,SAAUC,EAASC,GAC/C,SAASC,EAAUT,GAAS,IAAMU,EAAKL,EAAUM,KAAKX,IAAW,MAAOY,GAAKJ,EAAOI,IACpF,SAASC,EAASb,GAAS,IAAMU,EAAKL,EAAiB,MAAEL,IAAW,MAAOY,GAAKJ,EAAOI,IACvF,SAASF,EAAKI,GAJlB,IAAed,EAIac,EAAOC,KAAOR,EAAQO,EAAOd,QAJ1CA,EAIyDc,EAAOd,MAJhDA,aAAiBI,EAAIJ,EAAQ,IAAII,GAAE,SAAUG,GAAWA,EAAQP,OAITgB,KAAKP,EAAWI,GAClGH,GAAML,EAAYA,EAAUY,MAAMf,EAASC,GAAc,KAAKQ,WAI/D,SAASO,EAAYhB,EAASiB,GACjC,IAAsGC,EAAGC,EAAGC,EAAGC,EAA3GC,EAAI,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ArH,OAAMqH,EAAU,EAAG,KAAU,OAAArH,QACvFqH,EAAU,EAAG,KAAO,KACpBU,QAAQ,QACJG,EAAM,IAAAlI,OAAIqH,EAAU,EAAG,KAAK7K,SAAS,KAAMwD,OAAAqH,EAAU,EAAG,KAAK7K,SAAS,KAAGwD,OAAGqH,EAAU,EAAG,KAAK7K,SAAS,KACtGH,OAAAA,EAAiB,IAATA,EAAayL,EAAgB,IAATzL,EAAa2L,EAAe,IAAT3L,EAAa4L,EAAOC,EAAOL"}
--------------------------------------------------------------------------------
/lib/index.mjs:
--------------------------------------------------------------------------------
1 | var getTypeOf = function getTypeOf(param) {
2 | var type = Object.prototype.toString.call(param).slice(8, -1);
3 | return type.toLowerCase();
4 | };
5 |
6 | var is = function is(value, type) {
7 | return getTypeOf(value) === type.toLowerCase();
8 | };
9 |
10 | /*! *****************************************************************************
11 | Copyright (c) Microsoft Corporation.
12 |
13 | Permission to use, copy, modify, and/or distribute this software for any
14 | purpose with or without fee is hereby granted.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
17 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
18 | AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
19 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
20 | LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
21 | OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
22 | PERFORMANCE OF THIS SOFTWARE.
23 | ***************************************************************************** */
24 |
25 | function __awaiter(thisArg, _arguments, P, generator) {
26 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27 | return new (P || (P = Promise))(function (resolve, reject) {
28 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31 | step((generator = generator.apply(thisArg, _arguments || [])).next());
32 | });
33 | }
34 |
35 | function __generator(thisArg, body) {
36 | var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
37 | return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
38 | function verb(n) { return function (v) { return step([n, v]); }; }
39 | function step(op) {
40 | if (f) throw new TypeError("Generator is already executing.");
41 | while (_) try {
42 | if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
43 | if (y = 0, t) op = [op[0] & 2, t.value];
44 | switch (op[0]) {
45 | case 0: case 1: t = op; break;
46 | case 4: _.label++; return { value: op[1], done: false };
47 | case 5: _.label++; y = op[1]; op = [0]; continue;
48 | case 7: op = _.ops.pop(); _.trys.pop(); continue;
49 | default:
50 | if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
51 | if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
52 | if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
53 | if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
54 | if (t[2]) _.ops.pop();
55 | _.trys.pop(); continue;
56 | }
57 | op = body.call(thisArg, _);
58 | } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
59 | if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
60 | }
61 | }
62 |
63 | function __spreadArray(to, from, pack) {
64 | if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
65 | if (ar || !(i in from)) {
66 | if (!ar) ar = Array.prototype.slice.call(from, 0, i);
67 | ar[i] = from[i];
68 | }
69 | }
70 | return to.concat(ar || Array.prototype.slice.call(from));
71 | }
72 |
73 | var wait = function wait(milliseconds) {
74 | return __awaiter(void 0, void 0, void 0, function () {
75 | return __generator(this, function (_a) {
76 | return [2, new Promise(function (resolve) {
77 | return setTimeout(resolve, milliseconds);
78 | })];
79 | });
80 | });
81 | };
82 |
83 | var copyToClipboard = function copyToClipboard(text) {
84 | return new Promise(function (resolve, reject) {
85 | var textArea = document.createElement('textarea');
86 | textArea.value = text;
87 | textArea.style.position = 'fixed';
88 | textArea.style.top = '0';
89 | textArea.style.left = '0';
90 | textArea.style.opacity = '0';
91 | document.body.appendChild(textArea);
92 | textArea.focus();
93 | textArea.select();
94 |
95 | try {
96 | document.queryCommandValue('copy');
97 | resolve();
98 | } catch (err) {
99 | reject(err);
100 | }
101 |
102 | document.body.removeChild(textArea);
103 | });
104 | };
105 |
106 | var getFromClipboard = function getFromClipboard() {
107 | return new Promise(function (resolve, reject) {
108 | navigator.clipboard.readText().then(function (text) {
109 | resolve(text);
110 | })["catch"](function (err) {
111 | reject(err);
112 | });
113 | });
114 | };
115 |
116 | var throttle = function throttle(fn, ms) {
117 | if (ms === void 0) {
118 | ms = 1000;
119 | }
120 |
121 | var isRunning = false;
122 | return function () {
123 | var args = [];
124 |
125 | for (var _i = 0; _i < arguments.length; _i++) {
126 | args[_i] = arguments[_i];
127 | }
128 |
129 | if (isRunning) return;
130 | isRunning = true;
131 | setTimeout(function () {
132 | fn.apply(void 0, args);
133 | isRunning = false;
134 | }, ms);
135 | };
136 | };
137 |
138 | var removeHTMLTag = function removeHTMLTag(str) {
139 | return str.replace(/<[^>]+>/g, '');
140 | };
141 |
142 | function _typeof(obj) {
143 | "@babel/helpers - typeof";
144 |
145 | return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
146 | return typeof obj;
147 | } : function (obj) {
148 | return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
149 | }, _typeof(obj);
150 | }
151 |
152 | var isBrowser = (typeof window === "undefined" ? "undefined" : _typeof(window)) === 'object' && (typeof document === "undefined" ? "undefined" : _typeof(document)) === 'object';
153 |
154 | var getCookie = function getCookie(name) {
155 | if (!isBrowser) throw new Error("Non-browser environment, unavailable 'getCookie'");
156 | if (!document.cookie) throw new Error('No Cookie Found');
157 |
158 | if (name) {
159 | var reg = new RegExp("(^| )".concat(name, "=([^;]*)(;|$)"));
160 | var arr = document.cookie.match(reg);
161 | return arr ? arr[2] : undefined;
162 | }
163 |
164 | return document.cookie.split(';');
165 | };
166 |
167 | var clearCookie = function clearCookie() {
168 | if (!isBrowser) throw new Error("Non-browser environment, unavailable 'cleanCookies'");
169 | if (!document.cookie) throw new Error('No Cookie Found');
170 |
171 | for (var i = 0; i < getCookie().length; i++) {
172 | var element = getCookie()[i];
173 | document.cookie = element.replace(/^ +/, '').replace(element.match(/=(\S*)/)[1], "");
174 | }
175 | };
176 |
177 | var getBaseUrl = function getBaseUrl(url) {
178 | return url.includes('?') ? url.split('?')[0] : url;
179 | };
180 |
181 | var getUrlParams = function getUrlParams(url) {
182 | var params = {};
183 | var query = url.split('?')[1];
184 | if (!query) return params;
185 | var queryArr = query.split('&');
186 | queryArr.forEach(function (item) {
187 | var _a = item.split('='),
188 | key = _a[0],
189 | value = _a[1];
190 |
191 | if (params[key]) {
192 | if (Array.isArray(params[key])) {
193 | params[key].push(value);
194 | } else {
195 | params[key] = [params[key], value];
196 | }
197 | } else {
198 | params[key] = value;
199 | }
200 | });
201 | return params;
202 | };
203 |
204 | var goToTop = function goToTop() {
205 | var _a, _b, _c;
206 |
207 | var c = (_b = (_a = document === null || document === void 0 ? void 0 : document.documentElement) === null || _a === void 0 ? void 0 : _a.scrollTop) !== null && _b !== void 0 ? _b : (_c = document === null || document === void 0 ? void 0 : document.body) === null || _c === void 0 ? void 0 : _c.scrollTop;
208 |
209 | if (c > 0) {
210 | window.requestAnimationFrame(goToTop);
211 | window.scrollTo(0, c - c / 8);
212 | }
213 | };
214 |
215 | var log = {
216 | info: function info() {
217 | var args = [];
218 |
219 | for (var _i = 0; _i < arguments.length; _i++) {
220 | args[_i] = arguments[_i];
221 | }
222 |
223 | return console.log.apply(console, __spreadArray(["%c%s", 'color: #9E9E9E'], args, false));
224 | },
225 | error: function error() {
226 | var args = [];
227 |
228 | for (var _i = 0; _i < arguments.length; _i++) {
229 | args[_i] = arguments[_i];
230 | }
231 |
232 | return console.log.apply(console, __spreadArray(["%c%s", 'color: #d81e06'], args, false));
233 | },
234 | warn: function warn() {
235 | var args = [];
236 |
237 | for (var _i = 0; _i < arguments.length; _i++) {
238 | args[_i] = arguments[_i];
239 | }
240 |
241 | return console.log.apply(console, __spreadArray(["%c%s", 'color: #ffc107'], args, false));
242 | },
243 | debug: function debug() {
244 | var args = [];
245 |
246 | for (var _i = 0; _i < arguments.length; _i++) {
247 | args[_i] = arguments[_i];
248 | }
249 |
250 | return console.log.apply(console, __spreadArray(["%c%s", 'color: #2196f3'], args, false));
251 | },
252 | success: function success() {
253 | var args = [];
254 |
255 | for (var _i = 0; _i < arguments.length; _i++) {
256 | args[_i] = arguments[_i];
257 | }
258 |
259 | return console.log.apply(console, __spreadArray(["%c%s", 'color: #4caf50'], args, false));
260 | },
261 | color: function color(_color) {
262 | return function () {
263 | var args = [];
264 |
265 | for (var _i = 0; _i < arguments.length; _i++) {
266 | args[_i] = arguments[_i];
267 | }
268 |
269 | return console.log.apply(console, __spreadArray(["%c%s", "color: ".concat(_color)], args, false));
270 | };
271 | }
272 | };
273 |
274 | var average = function average(numbers) {
275 | return numbers.reduce(function (acc, curr) {
276 | return acc + curr;
277 | }, 0) / numbers.length;
278 | };
279 |
280 | var sum = function sum(numbers) {
281 | return numbers.reduce(function (acc, curr) {
282 | return acc + curr;
283 | }, 0);
284 | };
285 |
286 | var diffCount = function diffCount(a, b) {
287 | return a > b ? a - b : b - a;
288 | };
289 |
290 | var coorDistance = function coorDistance(p1, p2) {
291 | var x1 = p1.x,
292 | y1 = p1.y;
293 | var x2 = p2.x,
294 | y2 = p2.y;
295 | return Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));
296 | };
297 |
298 | var isMobile = function isMobile(str) {
299 | var reg = /^(?:(?:\+|00)86)?1(?:(?:3[\d])|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\d])|(?:9[189]))\d{8}$/;
300 | return reg.test(str);
301 | };
302 |
303 | var isRegexWith = function isRegexWith(regex, str) {
304 | return regex.test(str);
305 | };
306 |
307 | var isEmail = function isEmail(str) {
308 | var reg = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
309 | return reg.test(str);
310 | };
311 |
312 | var isUrl = function isUrl(str) {
313 | var reg = /^(((ht|f)tps?):\/\/)?([^!@#$%^&*?.\s-]([^!@#$%^&*?.\s]{0,63}[^!@#$%^&*?.\s])?\.)+[a-z]{2,6}\/?/;
314 | return reg.test(str);
315 | };
316 |
317 | var isChinese = function isChinese(str) {
318 | var reg = /^[\u4e00-\u9fa5]+$/;
319 | return reg.test(str);
320 | };
321 |
322 | var isIdCard = function isIdCard(str, type) {
323 | if (type === void 0) {
324 | type = 0;
325 | }
326 |
327 | var reg1 = /^[1-9]\d{7}(?:0\d|10|11|12)(?:0[1-9]|[1-2][\d]|30|31)\d{3}$/;
328 | var reg2 = /^[1-9]\d{5}(?:18|19|20)\d{2}(?:0[1-9]|10|11|12)(?:0[1-9]|[1-2]\d|30|31)\d{3}[\dXx]$/;
329 | var reg = /^\d{6}((((((19|20)\d{2})(0[13-9]|1[012])(0[1-9]|[12]\d|30))|(((19|20)\d{2})(0[13578]|1[02])31)|((19|20)\d{2})02(0[1-9]|1\d|2[0-8])|((((19|20)([13579][26]|[2468][048]|0[48]))|(2000))0229))\d{3})|((((\d{2})(0[13-9]|1[012])(0[1-9]|[12]\d|30))|((\d{2})(0[13578]|1[02])31)|((\d{2})02(0[1-9]|1\d|2[0-8]))|(([13579][26]|[2468][048]|0[048])0229))\d{2}))(\d|X|x)$/;
330 |
331 | switch (type) {
332 | case 1:
333 | return reg1.test(str);
334 |
335 | case 2:
336 | return reg2.test(str);
337 |
338 | default:
339 | return reg.test(str);
340 | }
341 | };
342 |
343 | function diffDays(date1, date2) {
344 | var time1 = date1.getTime();
345 | var time2 = date2.getTime();
346 | var diff = Math.abs(time1 >= time2 ? time1 - time2 : time2 - time1);
347 | return Math.floor(diff / (1000 * 60 * 60 * 24));
348 | }
349 |
350 | function formatSeconds(seconds, format) {
351 | if (!seconds && !is(seconds, 'number')) return '00:00';
352 | var hh = Math.floor(seconds / 3600);
353 | var mm = Math.floor(seconds % 3600 / 60);
354 | var ss = seconds % 60;
355 |
356 | switch (format) {
357 | case 'hh:mm:ss':
358 | return "".concat(hh < 10 ? '0' + hh : hh, ":").concat(mm < 10 ? '0' + mm : mm, ":").concat(ss < 10 ? '0' + ss : ss);
359 |
360 | case 'mm:ss':
361 | if (hh) return "".concat(hh * 60 + mm, ":").concat(ss < 10 ? '0' + ss : ss);
362 | return "".concat(mm, ":").concat(ss < 10 ? '0' + ss : ss);
363 |
364 | default:
365 | if (hh) return "".concat(hh * 60 + mm, ":").concat(ss < 10 ? '0' + ss : ss);
366 | return "".concat(mm < 10 ? '0' + mm : mm, ":").concat(ss < 10 ? '0' + ss : ss);
367 | }
368 | }
369 |
370 | var randomInt = function randomInt(min, max) {
371 | return Math.floor(Math.random() * (max - min + 1) + min);
372 | };
373 |
374 | var randomIP = function randomIP(type) {
375 | if (type === void 0) {
376 | type = 0;
377 | }
378 |
379 | var ipv4 = randomInt(0, 255) + '.' + randomInt(0, 255) + '.' + randomInt(0, 255) + '.' + randomInt(0, 255);
380 | var ipv6 = randomInt(0, 65535) + ':' + randomInt(0, 65535) + ':' + randomInt(0, 65535) + ':' + randomInt(0, 65535) + ':' + randomInt(0, 65535) + ':' + randomInt(0, 65535) + ':' + randomInt(0, 65535) + ':' + randomInt(0, 65535);
381 | return type ? ipv6 : ipv4;
382 | };
383 |
384 | var randomColor = function randomColor(type) {
385 | if (type === void 0) {
386 | type = 0;
387 | }
388 |
389 | var rgb = "rgb(".concat(randomInt(0, 255), ", ").concat(randomInt(0, 255), ", ").concat(randomInt(0, 255), ")");
390 | var rgba = "rgba(".concat(randomInt(0, 255), ", ").concat(randomInt(0, 255), ", ").concat(randomInt(0, 255), ", ").concat((randomInt(0, 255) / 255.0).toFixed(2), ")");
391 | var hsl = "hsl(".concat(randomInt(0, 360), ", ").concat(randomInt(0, 100), "%, ").concat(randomInt(0, 100), "%)");
392 | var hsla = "hsla(".concat(randomInt(0, 360), ", ").concat(randomInt(0, 100), "%, ").concat(randomInt(0, 100), "%, ").concat((randomInt(0, 100) / 255.0).toFixed(1), ")");
393 | var hex = "#".concat(randomInt(0, 255).toString(16)).concat(randomInt(0, 255).toString(16)).concat(randomInt(0, 255).toString(16));
394 | return type ? type === 1 ? rgba : type === 2 ? hsl : type === 3 ? hsla : hex : rgb;
395 | };
396 |
397 | export { average, clearCookie, coorDistance, copyToClipboard, diffCount, diffDays, formatSeconds, getBaseUrl, getCookie, getFromClipboard, getTypeOf, getUrlParams, goToTop, is, isBrowser, isChinese, isEmail, isIdCard, isMobile, isRegexWith, isUrl, log, randomColor, randomIP, randomInt, removeHTMLTag, sum, throttle, wait };
398 | //# sourceMappingURL=index.mjs.map
399 |
--------------------------------------------------------------------------------
/lib/index.mjs.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"index.mjs","sources":["../_basic/getTypeOf.ts","../_basic/is.ts","../node_modules/.pnpm/tslib@2.3.1/node_modules/tslib/tslib.es6.js","../_basic/wait.ts","../_basic/copyToClipboard.ts","../_basic/getFromClipboard.ts","../_basic/throttle.ts","../_basic/removeHTMLTag.ts","../_browser/isBrowser.ts","../_browser/getCookie.ts","../_browser/clearCookie.ts","../_browser/getBaseUrl.ts","../_browser/getUrlParams.ts","../_browser/goToTop.ts","../_browser/log.ts","../_calc/average.ts","../_calc/sum.ts","../_calc/diffCount.ts","../_calc/coorDistance.ts","../_regex/isMobile.ts","../_regex/isRegexWith.ts","../_regex/isEmail.ts","../_regex/isUrl.ts","../_regex/isChinese.ts","../_regex/isIdCard.ts","../_time/diffDays.ts","../_time/formatSeconds.ts","../_random/randomInt.ts","../_random/randomIP.ts","../_random/randomColor.ts"],"sourcesContent":["/**\n * @param {unknown} param\n * @returns {string}\n * String, Number, Boolean, Symbol, Null, Undefined, Object\n * Array, RegExp, Date, Error, Function, AsyncFunction, HTMLDocument\n */\nexport const getTypeOf = (param: unknown): string => {\n const type = Object.prototype.toString.call(param).slice(8, -1);\n return type.toLowerCase();\n};\n","/**\n * @func is\n * @param {any} value\n * @param {string} type\n */\nimport { getTypeOf } from './getTypeOf';\n\nexport const is = (value: any, type: string): boolean => {\n return getTypeOf(value) === type.toLowerCase();\n}\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n","/**\n * wait\n * @param {number} milliseconds\n */\nexport const wait = async (milliseconds: number) => new Promise(resolve => setTimeout(resolve, milliseconds));\n","/**\n * @func copyToClipboard\n * @desc 📝 Copy text to clipboard\n * @param {string} text\n * @returns {Promise}\n */\nexport const copyToClipboard = (text: string): Promise => {\n return new Promise((resolve, reject) => {\n const textArea = document.createElement('textarea');\n textArea.value = text;\n textArea.style.position = 'fixed';\n textArea.style.top = '0';\n textArea.style.left = '0';\n textArea.style.opacity = '0';\n document.body.appendChild(textArea);\n textArea.focus();\n textArea.select();\n try {\n // execCommand() API 已废弃⚠️\n // document.execCommand(\"copy\");\n document.queryCommandValue('copy');\n resolve();\n } catch (err) {\n reject(err);\n }\n document.body.removeChild(textArea);\n });\n};\n","/**\n * @func getFromClipboard\n * @desc 📝 Get text from clipboard\n * @returns {Promise}\n */\nexport const getFromClipboard = (): Promise => {\n return new Promise((resolve, reject) => {\n navigator.clipboard.readText()\n .then(text => {\n resolve(text);\n })\n .catch(err => {\n reject(err);\n });\n });\n};\n","/**\n * @func throttle\n * @desc 📝 函数节流,每隔一段时间执行一次,防止函数过于频繁调用,导致性能问题\n * @param {Function} fn\n * @param {number} [ms=1000]\n * @returns {Function}\n */\nexport const throttle = (fn: Function, ms: number = 1000): Function => {\n let isRunning = false;\n return (...args: any[]) => {\n if (isRunning) return;\n isRunning = true;\n setTimeout(() => {\n fn(...args);\n isRunning = false;\n }, ms);\n }\n}","/**\n * @func removeHTMLTag\n * @param {string} str\n * @return {string}\n * @desc 📝 去掉文本中所有标签,只保留文本\n */\nexport const removeHTMLTag = (str: string): string => str.replace(/<[^>]+>/g, '');\n","/**\n * isBrowser\n * 检测代码是否运行在浏览器环境\n */\n\nexport const isBrowser: boolean = typeof window === 'object' && typeof document === 'object';\n","import { isBrowser } from './isBrowser';\n\n/**\n * 获取cookie\n * new RegExp(`(^| )${name}=([^;]*)(;|$)`) 匹配 name=value 值\n * @param name[可选] cookie名称\n * @returns {Array | string | undefined}\n */\n\nexport const getCookie = (name?: string): Array | string | undefined => {\n // Environmental Test\n if (!isBrowser) throw new Error(\"Non-browser environment, unavailable 'getCookie'\");\n\n if (!document.cookie) throw new Error('No Cookie Found');\n\n if (name) {\n const reg = new RegExp(`(^| )${name}=([^;]*)(;|$)`);\n const arr = document.cookie.match(reg);\n return arr ? arr[2] : undefined;\n }\n\n // Get Cookies && String => Array\n return document.cookie.split(';');\n};\n","import { isBrowser } from './isBrowser';\nimport { getCookie } from './getCookie';\n/** \n * Clean Cookies\n * (/^ +/, '') 清除头部空格\n * match(/=(\\S*)/)[1] 提取cookie值\n * HttpOnly 不允许脚本读取,客户端无法操作\n */\n\nexport const clearCookie = () => {\n // Environmental Test\n if (!isBrowser) throw new Error(\"Non-browser environment, unavailable 'cleanCookies'\");\n \n if (!document.cookie) throw new Error('No Cookie Found');\n\n for (let i = 0; i < getCookie().length; i++) {\n const element = getCookie()[i];\n document.cookie = element.replace(/^ +/, '').replace(element.match(/=(\\S*)/)[1], ``);\n }\n}\n","/**\n * @func getBaseUrl\n * @param {string} url\n * @returns {string}\n * @desc 📝 获取 ? 前面的url\n */\nexport const getBaseUrl = (url: string): string => {\n return url.includes('?') ? url.split('?')[0] : url;\n};\n","/**\n * @func getUrlParams\n * @param {string} url\n * @returns {object}\n * @desc 📝 获取 url 中所有的参数,以对象的形式返回,如果参数名重复,则以数组的形式返回\n */\nexport const getUrlParams = (url: string): object => {\n const params: { [key: string]: any } = {};\n const query = url.split('?')[1];\n if (!query) return params;\n const queryArr = query.split('&');\n queryArr.forEach((item: string) => {\n const [key, value] = item.split('=');\n if (params[key]) {\n if (Array.isArray(params[key])) {\n params[key].push(value);\n } else {\n params[key] = [params[key], value];\n }\n } else {\n params[key] = value;\n }\n });\n return params;\n}","/**\n * @version v0.0.31\n * @func goToTop\n * @return {void}\n * @desc 📝 平滑滚动到顶部\n */\nexport const goToTop = (): void => {\n const c = document?.documentElement?.scrollTop ?? document?.body?.scrollTop;\n if (c > 0) {\n window.requestAnimationFrame(goToTop);\n window.scrollTo(0, c - c / 8);\n }\n}\n","/**\n * @func log\n * @desc 📝 Logs a message to the console.\n * @example log.info('Hello world'); log.error('Oh no!');\n */\n\nexport const log = {\n info: (...args: any[]) => console.log(`%c%s`, 'color: #9E9E9E', ...args),\n error: (...args: any[]) => console.log(`%c%s`, 'color: #d81e06', ...args),\n warn: (...args: any[]) => console.log(`%c%s`, 'color: #ffc107', ...args),\n debug: (...args: any[]) => console.log(`%c%s`, 'color: #2196f3', ...args),\n success: (...args: any[]) => console.log(`%c%s`, 'color: #4caf50', ...args),\n color: (color: string) => (...args: any[]) => console.log(`%c%s`, `color: ${color}`, ...args) as any,\n};\n","/**\n * @func average\n * @desc 📝 计算数组的平均值\n * @param {number[]} numbers\n * @returns {number}\n * @example average([1, 2, 3, 4, 5]) // 3\n */\nexport const average = (numbers: number[]): number => {\n return numbers.reduce((acc, curr) => acc + curr, 0) / numbers.length;\n};\n","/**\n * @func sum\n * @desc 📝 计算数组的和\n * @param {number[]} numbers\n * @returns {number}\n */\nexport const sum = (numbers: number[]): number => {\n return numbers.reduce((acc, curr) => acc + curr, 0);\n};\n","/**\n * @func diffCount\n * @param {number} a\n * @param {number} b\n * @returns {number}\n * @desc 计算两个数的差值\n */\nexport const diffCount = (a: number, b: number): number => a > b ? a - b : b - a","/**\n * @version v0.0.31\n * @func coorDistance\n * @param {object} coor1 - 坐标1\n * @param {object} coor2 - 坐标2\n * @returns {number} - 距离\n * @desc 📝 计算两个坐标点之间的距离\n */\ninterface Point {\n x: number;\n y: number;\n}\n\nexport const coorDistance = (p1: Point, p2: Point): number => {\n const { x: x1, y: y1 } = p1;\n const { x: x2, y: y2 } = p2;\n return Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));\n};\n","/**\n * @param {string} str\n * @returns {boolean}\n * @description Returns true if the string is a mobile phone number.\n */\nexport const isMobile = (str: string): boolean => {\n const reg = /^(?:(?:\\+|00)86)?1(?:(?:3[\\d])|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\\d])|(?:9[189]))\\d{8}$/;\n return reg.test(str);\n}\n","/**\n * 自定义正则表达式\n * @param {RegExp} regex 正则表达式\n * @param {string} str 字符串\n * @returns {boolean}\n */\n\nexport const isRegexWith = (regex: RegExp, str: string): boolean => regex.test(str);\n","/**\n * 是否是邮箱\n * @param {string} str\n * @returns {boolean}\n * @description Returns true if the string is a email.\n */\n\nexport const isEmail = (str: string): boolean => {\n const reg =\n /^(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n return reg.test(str);\n};\n","/**\n * 是否是url\n * @param {string} str\n * @returns {boolean}\n * @description Returns true if the string is a url.\n */\nexport const isUrl = (str: string): boolean => {\n const reg = /^(((ht|f)tps?):\\/\\/)?([^!@#$%^&*?.\\s-]([^!@#$%^&*?.\\s]{0,63}[^!@#$%^&*?.\\s])?\\.)+[a-z]{2,6}\\/?/;\n return reg.test(str);\n};\n","/**\n * 是否是中文\n * @param str 字符串\n * @returns {boolean}\n * @description Returns true if the string is a chinese.\n */\nexport const isChinese = (str: string): boolean => {\n const reg = /^[\\u4e00-\\u9fa5]+$/;\n return reg.test(str);\n};\n","/**\n * 是否为身份证号: 支持(1/2)代,15位或18位\n * @param {string} str 身份证号\n * @param {number} type 1:15位,2:18位,默认0 同时匹配15位和18位\n * @returns {boolean}\n * @description Returns true if the string is a id card.\n */\nexport const isIdCard = (str: string, type: number = 0): boolean => {\n // 1代身份证\n const reg1 = /^[1-9]\\d{7}(?:0\\d|10|11|12)(?:0[1-9]|[1-2][\\d]|30|31)\\d{3}$/;\n // 2代身份证\n const reg2 = /^[1-9]\\d{5}(?:18|19|20)\\d{2}(?:0[1-9]|10|11|12)(?:0[1-9]|[1-2]\\d|30|31)\\d{3}[\\dXx]$/;\n const reg =\n /^\\d{6}((((((19|20)\\d{2})(0[13-9]|1[012])(0[1-9]|[12]\\d|30))|(((19|20)\\d{2})(0[13578]|1[02])31)|((19|20)\\d{2})02(0[1-9]|1\\d|2[0-8])|((((19|20)([13579][26]|[2468][048]|0[48]))|(2000))0229))\\d{3})|((((\\d{2})(0[13-9]|1[012])(0[1-9]|[12]\\d|30))|((\\d{2})(0[13578]|1[02])31)|((\\d{2})02(0[1-9]|1\\d|2[0-8]))|(([13579][26]|[2468][048]|0[048])0229))\\d{2}))(\\d|X|x)$/;\n\n switch (type) {\n case 1:\n return reg1.test(str);\n case 2:\n return reg2.test(str);\n default:\n return reg.test(str);\n }\n};\n","/**\n * @func diffDays\n * @desc 📝比较两个日期相差的天数\n * @param {Date} date1\n * @param {Date} date2\n * @returns {number}\n */\nexport function diffDays(date1: Date, date2: Date): number {\n const time1 = date1.getTime();\n const time2 = date2.getTime();\n const diff = Math.abs(time1 >= time2 ? time1 - time2 : time2 - time1);\n return Math.floor(diff / (1000 * 60 * 60 * 24));\n}\n","import { is } from '../_basic/index'\n/**\n * @func formatSeconds\n * @param {number} seconds\n * @param {string} [format]\n * @returns {string} 'hh:mm:ss' | 'mm:ss'\n * @desc 📝格式化秒数, 可以指定格式, 默认为: 'mm:ss'.\n */\n\nexport function formatSeconds(seconds: number, format?: string): string {\n if (!seconds && !is(seconds, 'number')) return '00:00';\n const hh = Math.floor(seconds / 3600);\n const mm = Math.floor((seconds % 3600) / 60);\n const ss = seconds % 60;\n switch (format) {\n case 'hh:mm:ss':\n return `${hh < 10 ? '0' + hh : hh}:${mm < 10 ? '0' + mm : mm}:${ss < 10 ? '0' + ss : ss}`;\n case 'mm:ss':\n if (hh) return `${hh * 60 + mm}:${ss < 10 ? '0' + ss : ss}`;\n return `${mm}:${ss < 10 ? '0' + ss : ss}`;\n default:\n if (hh) return `${hh * 60 + mm}:${ss < 10 ? '0' + ss : ss}`;\n return `${mm < 10 ? '0' + mm : mm}:${ss < 10 ? '0' + ss : ss}`;\n }\n}\n","/**\n * @func randomInt\n * @param {number} min - min number\n * @param {number} max - max number\n * @returns {number} - random number\n */\nexport const randomInt = (min: number, max: number): number => {\n return Math.floor(Math.random() * (max - min + 1) + min);\n}","import { randomInt } from './randomInt'\n\n/**\n * @func randomIP\n * @param {number} type - 0: ipv4, 1: ipv6\n * @returns {string} - random ip address\n * @desc 生成一个随机的IP地址,可以是IPv4或者IPv6\n */\n\nexport const randomIP = (type: number = 0): string => {\n const ipv4 = randomInt(0, 255) + '.' + randomInt(0, 255) + '.' + randomInt(0, 255) + '.' + randomInt(0, 255);\n const ipv6 =\n randomInt(0, 65535) +\n ':' +\n randomInt(0, 65535) +\n ':' +\n randomInt(0, 65535) +\n ':' +\n randomInt(0, 65535) +\n ':' +\n randomInt(0, 65535) +\n ':' +\n randomInt(0, 65535) +\n ':' +\n randomInt(0, 65535) +\n ':' +\n randomInt(0, 65535);\n return type ? ipv6 : ipv4;\n};\n","import { randomInt } from './randomInt';\n/**\n * @func randomColor\n * @param {type} type - 0: rgb, 1: rgba, 2: hsl, 3: hsla, 4: hex\n * @returns {string} - random color\n * @desc 📝生成一个随机的颜色值\n */\n\nexport const randomColor = (type: number = 0): string => {\n const rgb = `rgb(${randomInt(0, 255)}, ${randomInt(0, 255)}, ${randomInt(0, 255)})`;\n const rgba = `rgba(${randomInt(0, 255)}, ${randomInt(0, 255)}, ${randomInt(0, 255)}, ${(\n randomInt(0, 255) / 255.0\n ).toFixed(2)})`;\n const hsl = `hsl(${randomInt(0, 360)}, ${randomInt(0, 100)}%, ${randomInt(0, 100)}%)`;\n const hsla = `hsla(${randomInt(0, 360)}, ${randomInt(0, 100)}%, ${randomInt(0, 100)}%, ${(\n randomInt(0, 100) / 255.0\n ).toFixed(1)})`;\n const hex = `#${randomInt(0, 255).toString(16)}${randomInt(0, 255).toString(16)}${randomInt(0, 255).toString(16)}`;\n return type ? (type === 1 ? rgba : type === 2 ? hsl : type === 3 ? hsla : hex) : rgb;\n};\n"],"names":["getTypeOf","param","type","Object","prototype","toString","call","slice","toLowerCase","is","value","wait","milliseconds","__awaiter","__generator","_a","Promise","resolve","setTimeout","copyToClipboard","text","reject","textArea","document","createElement","style","position","top","left","opacity","body","appendChild","focus","select","queryCommandValue","err","removeChild","getFromClipboard","navigator","clipboard","readText","then","throttle","fn","ms","isRunning","args","_i","arguments","length","apply","removeHTMLTag","str","replace","isBrowser","window","getCookie","name","Error","cookie","reg","RegExp","concat","arr","match","undefined","split","clearCookie","i","element","getBaseUrl","url","includes","getUrlParams","params","query","queryArr","forEach","item","key","Array","isArray","push","goToTop","c","_b","documentElement","scrollTop","_c","requestAnimationFrame","scrollTo","log","info","console","error","warn","debug","success","color","__spreadArray","average","numbers","reduce","acc","curr","sum","diffCount","a","b","coorDistance","p1","p2","x1","x","y1","y","x2","y2","Math","sqrt","pow","isMobile","test","isRegexWith","regex","isEmail","isUrl","isChinese","isIdCard","reg1","reg2","diffDays","date1","date2","time1","getTime","time2","diff","abs","floor","formatSeconds","seconds","format","hh","mm","ss","randomInt","min","max","random","randomIP","ipv4","ipv6","randomColor","rgb","rgba","toFixed","hsl","hsla","hex"],"mappings":"IAMaA,SAAS,GAAG,SAAZA,SAAY,CAACC,KAAD,EAAe;AACtC,EAAA,IAAMC,IAAI,GAAGC,MAAM,CAACC,SAAP,CAAiBC,QAAjB,CAA0BC,IAA1B,CAA+BL,KAA/B,EAAsCM,KAAtC,CAA4C,CAA5C,EAA+C,CAAC,CAAhD,CAAb,CAAA;AACA,EAAOL,OAAAA,IAAI,CAACM,WAAL,EAAP,CAAA;AACD;;ACFM,IAAMC,EAAE,GAAG,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,EAAI,GAAJ,CAAT,GAAoB,KADmE,EAEvFU,OAFuF,CAE/E,CAF+E,CAA5E,KAAA,CAAb,CAAA;AAGA,EAAMG,IAAAA,GAAG,GAAG,GAAAjG,CAAAA,MAAA,CAAIoF,SAAS,CAAC,CAAD,EAAI,GAAJ,CAAT,CAAkB7I,QAAlB,CAA2B,EAA3B,CAAJ,EAAqCyD,MAArC,CAAqCoF,SAAS,CAAC,CAAD,EAAI,GAAJ,CAAT,CAAkB7I,QAAlB,CAA2B,EAA3B,CAArC,CAAA,CAAmEyD,MAAnE,CAAsEoF,SAAS,CAAC,CAAD,EAAI,GAAJ,CAAT,CAAkB7I,QAAlB,CAA2B,EAA3B,CAAtE,CAAZ,CAAA;AACA,EAAOH,OAAAA,IAAI,GAAIA,IAAI,KAAK,CAAT,GAAayJ,IAAb,GAAoBzJ,IAAI,KAAK,CAAT,GAAa2J,GAAb,GAAmB3J,IAAI,KAAK,CAAT,GAAa4J,IAAb,GAAoBC,GAA/D,GAAsEL,GAAjF,CAAA;AACD;;;;"}
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "atools-js",
3 | "version": "0.0.31",
4 | "description": "现代 JavaScript 实用工具库🔧",
5 | "main": "lib/index.min.js",
6 | "module": "lib/index.min.mjs",
7 | "types": "lib/index.d.ts",
8 | "scripts": {
9 | "test": "jest",
10 | "dev": "rollup -c -w",
11 | "build": "rm -rf lib && rollup -c"
12 | },
13 | "keywords": [
14 | "javascript",
15 | "typescript",
16 | "atools-js",
17 | "atools",
18 | "tools",
19 | "js",
20 | "ts",
21 | "es6",
22 | "esnext"
23 | ],
24 | "author": "山人自有妙计",
25 | "license": "MIT",
26 | "repository": {
27 | "type": "git",
28 | "url": "https://github.com/wangdaoo/atools"
29 | },
30 | "publishConfig": {
31 | "access": "public",
32 | "registry": "https://registry.npmjs.org/"
33 | },
34 | "bugs": {
35 | "url": "https://github.com/wangdaoo/atools/issues"
36 | },
37 | "homepage": "https://atools.vercel.app",
38 | "devDependencies": {
39 | "@babel/core": "^7.16.7",
40 | "@babel/preset-env": "^7.16.7",
41 | "@babel/preset-typescript": "^7.16.7",
42 | "@rollup/plugin-commonjs": "^21.0.1",
43 | "@rollup/plugin-node-resolve": "^13.1.3",
44 | "@rollup/plugin-typescript": "^8.3.0",
45 | "@types/jest": "^27.4.0",
46 | "@types/node": "^17.0.8",
47 | "babel-jest": "^27.4.6",
48 | "jest": "^27.4.7",
49 | "rollup": "^2.63.0",
50 | "rollup-plugin-babel": "^4.4.0",
51 | "rollup-plugin-dts": "^4.1.0",
52 | "rollup-plugin-peer-deps-external": "^2.2.4",
53 | "rollup-plugin-terser": "^7.0.2",
54 | "ts-jest": "^27.1.2",
55 | "ts-node": "^10.4.0",
56 | "tslib": "^2.3.1",
57 | "typescript": "^4.5.4"
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/rollup.config.js:
--------------------------------------------------------------------------------
1 | import path from 'path';
2 | import commonjs from '@rollup/plugin-commonjs';
3 | import babel from 'rollup-plugin-babel';
4 | import dts from 'rollup-plugin-dts';
5 | import { nodeResolve } from '@rollup/plugin-node-resolve';
6 | import typescript from '@rollup/plugin-typescript';
7 | import peerDepsExternal from 'rollup-plugin-peer-deps-external';
8 | import { terser } from 'rollup-plugin-terser';
9 | import pkg from './package.json';
10 |
11 | const extensions = ['.ts'];
12 | const dir = 'lib';
13 | const resolve = (...args) => path.resolve(...args);
14 |
15 | const config = [
16 | {
17 | input: resolve('./index.ts'),
18 | output: [
19 | {
20 | file: resolve(`./${dir}/index.js`),
21 | format: 'umd',
22 | name: 'atools',
23 | sourcemap: true,
24 | },
25 | {
26 | file: resolve(`./${dir}/index.min.js`),
27 | format: 'umd',
28 | name: 'atools',
29 | sourcemap: true,
30 | plugins: [terser()],
31 | },
32 | {
33 | file: resolve(`./${dir}/index.mjs`),
34 | format: 'esm',
35 | name: 'atools',
36 | sourcemap: true
37 | },
38 | {
39 | file: resolve(`./${dir}/index.min.mjs`),
40 | format: 'esm',
41 | name: 'atools',
42 | sourcemap: true,
43 | plugins: [terser()],
44 | }
45 | ],
46 | plugins: [
47 | peerDepsExternal(),
48 | nodeResolve({
49 | extensions,
50 | }),
51 | commonjs({ include: 'node_modules/**' }),
52 | typescript({ tsconfig: './tsconfig.json', declaration: false }),
53 | babel({
54 | extensions,
55 | exclude: 'node_modules/**'
56 | }),
57 | ],
58 | },
59 | {
60 | // 生成 .d.ts 类型声明文件
61 | input: resolve('./index.ts'),
62 | output: {
63 | file: resolve('./', pkg.types),
64 | format: 'es',
65 | },
66 | plugins: [dts()],
67 | },
68 | ];
69 |
70 | export default config;
71 |
--------------------------------------------------------------------------------
/static/atools_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lynxlangya/atools/88167d3be2d395101813c4e42a6af86d918910f5/static/atools_logo.png
--------------------------------------------------------------------------------
/static/wechat.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lynxlangya/atools/88167d3be2d395101813c4e42a6af86d918910f5/static/wechat.png
--------------------------------------------------------------------------------
/test/basic/is.test.ts:
--------------------------------------------------------------------------------
1 | import { is } from '../../_basic/is';
2 |
3 | test('is', () => {
4 | expect(is(1, 'NUMBER')).toBe(true);
5 | expect(is('1', 'number')).toBe(false);
6 | expect(is(false, 'boolean')).toBe(true);
7 | expect(is(null, 'null')).toBe(true);
8 | expect(is(undefined, 'undefined')).toBe(true);
9 | expect(is({}, 'object')).toBe(true);
10 | expect(is(/a/, 'regexp')).toBe(true);
11 | expect(is(new Date(), 'date')).toBe(true);
12 | expect(is(new Error(), 'error')).toBe(true);
13 | expect(is(() => {}, 'function')).toBe(true);
14 | });
15 |
--------------------------------------------------------------------------------
/test/browser/getBaseUrl.test.ts:
--------------------------------------------------------------------------------
1 | import { getBaseUrl } from '../../_browser/getBaseUrl';
2 |
3 | test('getBaseUrl', () => {
4 | expect(getBaseUrl('https://www.baidu.com/s?wd=123')).toBe('https://www.baidu.com/s');
5 | expect(getBaseUrl('https://www.baidu.com/s?wd=123&ie=utf-8')).toBe('https://www.baidu.com/s');
6 | expect(getBaseUrl('https://www.baidu.com/s?')).toBe('https://www.baidu.com/s');
7 | });
--------------------------------------------------------------------------------
/test/browser/getUrlParams.test.ts:
--------------------------------------------------------------------------------
1 | import { getUrlParams } from '../../_browser/getUrlParams';
2 |
3 | test('getUrlParams', () => {
4 | expect(getUrlParams('https://www.baidu.com/s?wd=123')).toEqual({ wd: '123' });
5 | expect(getUrlParams('https://www.baidu.com/s?wd=123&ie=utf-8')).toEqual({ wd: '123', ie: 'utf-8' });
6 | expect(getUrlParams('https://www.baidu.com/s?')).toEqual({});
7 | expect(getUrlParams('https://www.baidu.com/s?wd=123&wd=456')).toEqual({ wd: ['123', '456'] });
8 | });
9 |
--------------------------------------------------------------------------------
/test/calc/average.test.ts:
--------------------------------------------------------------------------------
1 | import { average } from '../../_calc/average';
2 |
3 | test('average', () => {
4 | expect(average([1, 2, 3, 4, 5])).toBe(3);
5 | expect(average([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])).toBe(5.5);
6 | });
7 |
--------------------------------------------------------------------------------
/test/calc/coorDistance.test.ts:
--------------------------------------------------------------------------------
1 | import { coorDistance } from '../../_calc/coorDistance';
2 |
3 | test('coorDistance', () => {
4 | const p1 = { x: 0, y: 0 };
5 | const p2 = { x: 1, y: 1 };
6 | expect(coorDistance(p1, p2)).toBe(Math.sqrt(2));
7 |
8 | const p3 = { x: 0, y: 10 };
9 | expect(coorDistance(p1, p3)).toBe(10);
10 | });
11 |
--------------------------------------------------------------------------------
/test/calc/diffCount.test.ts:
--------------------------------------------------------------------------------
1 | import { diffCount } from '../../_calc/diffCount';
2 |
3 | test('diffCount', () => {
4 | expect(diffCount(1, 2)).toBe(1);
5 | expect(diffCount(2, 1)).toBe(1);
6 | expect(diffCount(1, 1)).toBe(0);
7 | expect(diffCount(2, 2)).toBe(0);
8 | });
9 |
--------------------------------------------------------------------------------
/test/calc/sum.test.ts:
--------------------------------------------------------------------------------
1 | import { sum } from '../../_calc/sum';
2 |
3 | test('sum', () => {
4 | expect(sum([1, 2, 3, 4, 5])).toBe(15);
5 | });
--------------------------------------------------------------------------------
/test/fn/throttle.test.ts:
--------------------------------------------------------------------------------
1 | import { throttle } from '../../_basic/throttle';
2 |
3 | test('throttle', () => {
4 | let count = 0;
5 | const fn = () => count++;
6 | const throttled = throttle(fn);
7 | throttled();
8 | throttled();
9 | throttled();
10 | throttled();
11 | });
12 |
--------------------------------------------------------------------------------
/test/html/removeHTMLTag.test.ts:
--------------------------------------------------------------------------------
1 | import { removeHTMLTag } from '../../_basic/removeHTMLTag';
2 |
3 | test('removeHTMLTag', () => {
4 | expect(removeHTMLTag('Hello
')).toBe('Hello');
5 | expect(removeHTMLTag('Title
Content
imageTitle
')).toBe('TitleContentimageTitle');
6 | expect(removeHTMLTag('Title
')).toBe('Title');
7 | expect(removeHTMLTag('Hello')).toBe('Hello');
8 | });
--------------------------------------------------------------------------------
/test/regex/isChinese.test.ts:
--------------------------------------------------------------------------------
1 | import { isChinese } from '../../_regex/isChinese';
2 |
3 | test('isChinese', () => {
4 | expect(isChinese('中文')).toBe(true);
5 | expect(isChinese('Hello')).toBe(false);
6 | });
7 |
--------------------------------------------------------------------------------
/test/regex/isEmail.test.ts:
--------------------------------------------------------------------------------
1 | import { isEmail } from '../../_regex/isEmail';
2 |
3 | test('isEmail', () => {
4 | expect(isEmail('wangdaoo@yeah.net')).toBe(true);
5 | expect(isEmail('#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})')).toBe(false);
6 | expect(isEmail('Hello')).toBe(false);
7 | });
8 |
--------------------------------------------------------------------------------
/test/regex/isIdCard.test.ts:
--------------------------------------------------------------------------------
1 | import { isIdCard } from '../../_regex/isIdCard';
2 |
3 | test('isIdCard', () => {
4 | expect(isIdCard('420102199003027001')).toBe(true);
5 | expect(isIdCard('42010219900302700')).toBe(false);
6 | expect(isIdCard('420102199003027')).toBe(false);
7 | expect(isIdCard('42010219900302')).toBe(false);
8 | expect(isIdCard('42010219900302700X')).toBe(true);
9 | expect(isIdCard('42010219900302700x')).toBe(true);
10 | expect(isIdCard('370202541216162', 1)).toBe(true);
11 | expect(isIdCard('42010219900302700x', 2)).toBe(true);
12 | });
13 |
--------------------------------------------------------------------------------
/test/regex/isMobile.test.ts:
--------------------------------------------------------------------------------
1 | import { isMobile } from '../../_regex/isMobile';
2 |
3 | test('isMobile', () => {
4 | expect(isMobile('13012345678')).toBe(true);
5 | expect(isMobile('130123456789')).toBe(false);
6 | expect(isMobile('1301234567')).toBe(false);
7 | expect(isMobile('13012345678901')).toBe(false);
8 | expect(isMobile('130123456789012')).toBe(false);
9 | expect(isMobile('1301234567890123')).toBe(false);
10 | expect(isMobile('17511686400')).toBe(true);
11 | expect(isMobile('3115008')).toBe(false);
12 | });
13 |
--------------------------------------------------------------------------------
/test/regex/isRegexWith.test.ts:
--------------------------------------------------------------------------------
1 | import { isRegexWith } from '../../_regex/isRegexWith';
2 |
3 | test('isRegexWith', () => {
4 | expect(isRegexWith(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/, 'wangdaoo@yeah.net')).toBe(true);
5 | expect(isRegexWith(/^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/, 'rgba(0,0,0,1)')).toBe(false);
6 | });
7 |
--------------------------------------------------------------------------------
/test/regex/isUrl.test.ts:
--------------------------------------------------------------------------------
1 | import { isUrl } from '../../_regex/isUrl';
2 |
3 | test('isUrl', () => {
4 | expect(isUrl('http://www.baidu.com')).toBe(true);
5 | expect(isUrl('https://www.baidu.com')).toBe(true);
6 | expect(isUrl('www.baidu.com')).toBe(true);
7 | expect(isUrl('baidu.com')).toBe(true);
8 | expect(isUrl('baidu.com/')).toBe(true);
9 | expect(isUrl('baidu.com/index.html')).toBe(true);
10 | expect(isUrl('baidu.com/index.html?a=1&b=2')).toBe(true);
11 | expect(isUrl('baidu.com/index.html?a=1&b=2#hash')).toBe(true);
12 | expect(isUrl('baidu')).toBe(false);
13 | });
14 |
--------------------------------------------------------------------------------
/test/time/diffDays.test.ts:
--------------------------------------------------------------------------------
1 | import { diffDays } from '../../_time/diffDays';
2 |
3 | test('diffDays', () => {
4 | expect(diffDays(new Date(2020, 0, 2), new Date(2020, 0, 1))).toBe(1);
5 | expect(diffDays(new Date('2022-01-01 12:12:12'), new Date('2022-01-02 10:12:10'))).toBe(0);
6 | });
7 |
--------------------------------------------------------------------------------
/test/time/formatSeconds.test.ts:
--------------------------------------------------------------------------------
1 | import { formatSeconds } from '../../_time/formatSeconds';
2 |
3 | test('formatSeconds', () => {
4 | expect(formatSeconds(0)).toBe('00:00');
5 | expect(formatSeconds(1)).toBe('00:01');
6 | expect(formatSeconds(59)).toBe('00:59');
7 | expect(formatSeconds(61)).toBe('01:01');
8 | expect(formatSeconds(3599)).toBe('59:59');
9 | expect(formatSeconds(3600)).toBe('60:00');
10 | expect(formatSeconds(3601)).toBe('60:01');
11 | expect(formatSeconds(3599, 'mm:ss')).toBe('59:59');
12 | expect(formatSeconds(3600, 'mm:ss')).toBe('60:00');
13 | expect(formatSeconds(3601, 'mm:ss')).toBe('60:01');
14 | expect(formatSeconds(3599, 'hh:mm:ss')).toBe('00:59:59');
15 | expect(formatSeconds(3600, 'hh:mm:ss')).toBe('01:00:00');
16 | expect(formatSeconds(3601, 'hh:mm:ss')).toBe('01:00:01');
17 | });
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | /* Visit https://aka.ms/tsconfig.json to read more about this file */
4 |
5 | /* Basic Options */
6 | // "incremental": true, /* Enable incremental compilation */
7 | "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
8 | "module": "ESNext", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
9 | // "lib": [], /* Specify library files to be included in the compilation. */
10 | // "allowJs": true, /* Allow javascript files to be compiled. */
11 | // "checkJs": true, /* Report errors in .js files. */
12 | // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */
13 | // "declaration": true, /* Generates corresponding '.d.ts' file. */
14 | // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
15 | // "sourceMap": true, /* Generates corresponding '.map' file. */
16 | // "outFile": "./", /* Concatenate and emit output to single file. */
17 | // "outDir": "./", /* Redirect output structure to the directory. */
18 | // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
19 | // "composite": true, /* Enable project compilation */
20 | // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
21 | // 移除注释
22 | "removeComments": true, /* Do not emit comments to output. */
23 | // "noEmit": true, /* Do not emit outputs. */
24 | // "importHelpers": true, /* Import emit helpers from 'tslib'. */
25 | // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
26 | // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
27 |
28 | /* Strict Type-Checking Options */
29 | "strict": true, /* Enable all strict type-checking options. */
30 | // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
31 | "strictNullChecks": false, /* Enable strict null checks. */
32 | // "strictFunctionTypes": true, /* Enable strict checking of function types. */
33 | // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
34 | // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
35 | // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
36 | // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
37 |
38 | /* Additional Checks */
39 | // "noUnusedLocals": true, /* Report errors on unused locals. */
40 | // "noUnusedParameters": true, /* Report errors on unused parameters. */
41 | // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
42 | // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
43 | // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
44 | // "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */
45 |
46 | /* Module Resolution Options */
47 | // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
48 | // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
49 | // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
50 | // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
51 | // "typeRoots": [], /* List of folders to include type definitions from. */
52 | // "types": [], /* Type declaration files to be included in compilation. */
53 | // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
54 | "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
55 | // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
56 | // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
57 |
58 | /* Source Map Options */
59 | // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
60 | // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
61 | // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
62 | // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
63 |
64 | /* Experimental Options */
65 | // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
66 | // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
67 |
68 | /* Advanced Options */
69 | "skipLibCheck": true, /* Skip type checking of declaration files. */
70 | "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
71 | }
72 | }
73 |
--------------------------------------------------------------------------------