@mudbean/utils 2.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/CHANGELOG.md +170 -0
  2. package/LICENSE +15 -0
  3. package/README.md +51 -0
  4. package/cjs/array/difference.js +48 -0
  5. package/cjs/array/index.js +133 -0
  6. package/cjs/array/intersection.js +40 -0
  7. package/cjs/array/symmetricDifference.js +45 -0
  8. package/cjs/array/union.js +62 -0
  9. package/cjs/className.js +55 -0
  10. package/cjs/createBezier.js +135 -0
  11. package/cjs/getRandomNumber.js +70 -0
  12. package/cjs/getRandomString.js +143 -0
  13. package/cjs/index.js +40 -0
  14. package/cjs/isNode.js +23 -0
  15. package/cjs/object/createConstructor.js +59 -0
  16. package/cjs/performance.js +138 -0
  17. package/cjs/regexp/autoEscapedRegExp.js +44 -0
  18. package/cjs/regexp/escapeRegExp.js +22 -0
  19. package/cjs/regexp/parse.js +31 -0
  20. package/cjs/sleep.js +37 -0
  21. package/es/array/difference.d.ts +29 -0
  22. package/es/array/difference.js +46 -0
  23. package/es/array/index.d.ts +125 -0
  24. package/es/array/index.js +127 -0
  25. package/es/array/intersection.d.ts +17 -0
  26. package/es/array/intersection.js +38 -0
  27. package/es/array/symmetricDifference.d.ts +27 -0
  28. package/es/array/symmetricDifference.js +43 -0
  29. package/es/array/union.d.ts +39 -0
  30. package/es/array/union.js +60 -0
  31. package/es/className.d.ts +26 -0
  32. package/es/className.js +52 -0
  33. package/es/createBezier.d.ts +64 -0
  34. package/es/createBezier.js +133 -0
  35. package/es/getRandomNumber.d.ts +24 -0
  36. package/es/getRandomNumber.js +67 -0
  37. package/es/getRandomString.d.ts +73 -0
  38. package/es/getRandomString.js +141 -0
  39. package/es/index.d.ts +12 -0
  40. package/es/index.js +15 -0
  41. package/es/isNode.d.ts +8 -0
  42. package/es/isNode.js +20 -0
  43. package/es/object/createConstructor.d.ts +47 -0
  44. package/es/object/createConstructor.js +56 -0
  45. package/es/object/index.d.ts +2 -0
  46. package/es/performance.d.ts +61 -0
  47. package/es/performance.js +135 -0
  48. package/es/regexp/autoEscapedRegExp.d.ts +28 -0
  49. package/es/regexp/autoEscapedRegExp.js +42 -0
  50. package/es/regexp/escapeRegExp.d.ts +16 -0
  51. package/es/regexp/escapeRegExp.js +20 -0
  52. package/es/regexp/index.d.ts +2 -0
  53. package/es/regexp/parse.d.ts +6 -0
  54. package/es/regexp/parse.js +29 -0
  55. package/es/regexp/types.d.ts +10 -0
  56. package/es/sleep.d.ts +25 -0
  57. package/es/sleep.js +35 -0
  58. package/package.json +118 -0
@@ -0,0 +1,56 @@
1
+ /**
2
+ * # 构建一个 Constructor 构造函数
3
+ *
4
+ * 接收一个构造函数,然后返回 TS 能识别的构造函数自身
5
+ *
6
+ * 函数本身并没有执行任何逻辑,仅是简单的返回了实参自身
7
+ *
8
+ * 而经过该函数的包装,构造函数成了能够被 TS 识别为可用 new 实例的构造函数
9
+ *
10
+ * @param constructor - 传入一个构造函数
11
+ * @returns 返回传入的构造函数
12
+ * @example
13
+ * ```ts
14
+ * import { createConstructor } from "@mudbean/utils";
15
+ *
16
+ * type Tom = {
17
+ * a: number
18
+ * }
19
+ *
20
+ * function _Tom (this: TomType): Tom {
21
+ * this.a = 1;
22
+ *
23
+ * return this;
24
+ * }
25
+ *
26
+ * // 逻辑上没有错,但是会造成 ts 显示
27
+ * // 其目标缺少构造签名的 "new" 表达式隐式具有 "any" 类型。ts(7009)
28
+ * const a = new _Tom();
29
+ *
30
+ * const tomConstructor = createConstructor(_tom);
31
+ *
32
+ * const b = new tomConstructor(); // 这时就不会显示错误
33
+ * ```
34
+ */
35
+ function createConstructor(constructor) {
36
+ constructor.prototype.apply = Function.apply;
37
+ constructor.prototype.bind = Function.bind;
38
+ constructor.prototype.call = Function.call;
39
+ constructor.prototype.length = Function.length;
40
+ // constructor.prototype.arguments = Function.arguments;
41
+ constructor.prototype.name = Function.name;
42
+ constructor.prototype.toString = Function.toString;
43
+ return constructor;
44
+ }
45
+ /**
46
+ * # 对象的 assign 用法
47
+ * @param target
48
+ * @param bar
49
+ */
50
+ function ObjectAssign(target, bar) {
51
+ const keys = Object.keys(bar);
52
+ keys.forEach(key => (target[key] = bar[key]));
53
+ return target;
54
+ }
55
+
56
+ export { ObjectAssign, createConstructor };
@@ -0,0 +1,2 @@
1
+ export type { CreateConstructor } from './createConstructor';
2
+ export { createConstructor } from './createConstructor';
@@ -0,0 +1,61 @@
1
+ type Callback = (...args: any[]) => void;
2
+ /**
3
+ * 节流和防抖返回值类型
4
+ */
5
+ export interface DebounceAndThrottleReturnType<F extends Callback> {
6
+ (...args: Parameters<F>): void;
7
+ cancel(): void;
8
+ }
9
+ /** 第二参数 */
10
+ export type debounce_throttle_options = {
11
+ delay?: number;
12
+ this?: null | unknown;
13
+ } | number;
14
+ /**
15
+ * # 防抖
16
+ *
17
+ * @param callback 回调函数
18
+ * @param options 延迟时间(毫秒),默认 200 (ms) 或包含 this 的配置
19
+ * @returns 返回的闭包函数
20
+ * @example
21
+ *
22
+ * ```ts
23
+ * import { debounce } from '@mudbean/utils';
24
+ *
25
+ * const debounce = (callback: Function, delay = 300) => {
26
+ * let timer: any = null
27
+ *
28
+ * return (...args: any[]) => clearTimeout(timer)
29
+ * }
30
+ *
31
+ * debounce(); // 未执行
32
+ * debounce(); // 未执行
33
+ * debounce(); // 未执行
34
+ * debounce(); // 执行
35
+ * ```
36
+ */
37
+ export declare function debounce<F extends Callback>(callback: F, options?: debounce_throttle_options): DebounceAndThrottleReturnType<F>;
38
+ /**
39
+ * # 节流
40
+ *
41
+ * @param callback 回调函数
42
+ * @param options 延迟时间(毫秒),默认 200 (ms) 或设置 this
43
+ * @returns 返回的闭包函数
44
+ * @example
45
+ *
46
+ * ```ts
47
+ * import { throttle , sleep } form "@mudbean/utils";
48
+ *
49
+ * const a_throttle_fn = throttle(()=> {
50
+ * console.log("hello");
51
+ * }, 1200);
52
+ *
53
+ * a_throttle_fn(); // 正常打印
54
+ * a_throttle_fn(); // 跳过打印
55
+ * await sleep(1200); // 等待 1200ms
56
+ * a_throttle_fn(); // 正常打印
57
+ * a_throttle_fn(); // 跳过打印
58
+ * ```
59
+ */
60
+ export declare function throttle<F extends Callback>(callback: F, options?: debounce_throttle_options): DebounceAndThrottleReturnType<F>;
61
+ export {};
@@ -0,0 +1,135 @@
1
+ import { isFunction, isNumber, isUndefined, isNull } from '@mudbean/is';
2
+
3
+ /**
4
+ * 防抖和节流
5
+ */
6
+ /**
7
+ * # 防抖
8
+ *
9
+ * @param callback 回调函数
10
+ * @param options 延迟时间(毫秒),默认 200 (ms) 或包含 this 的配置
11
+ * @returns 返回的闭包函数
12
+ * @example
13
+ *
14
+ * ```ts
15
+ * import { debounce } from '@mudbean/utils';
16
+ *
17
+ * const debounce = (callback: Function, delay = 300) => {
18
+ * let timer: any = null
19
+ *
20
+ * return (...args: any[]) => clearTimeout(timer)
21
+ * }
22
+ *
23
+ * debounce(); // 未执行
24
+ * debounce(); // 未执行
25
+ * debounce(); // 未执行
26
+ * debounce(); // 执行
27
+ * ```
28
+ */
29
+ function debounce(callback, options = 200) {
30
+ if (!isFunction(callback))
31
+ throw new TypeError('callback must be a function');
32
+ if (isNumber(options))
33
+ options = {
34
+ delay: options,
35
+ this: null,
36
+ };
37
+ if (isUndefined(options.delay) ||
38
+ !isFinite(options.delay) ||
39
+ options.delay < 0)
40
+ // 强制转换非数值
41
+ options.delay = 200;
42
+ /** 定时器返回的 id */
43
+ let timeoutId;
44
+ const clear = () => {
45
+ if (timeoutId) {
46
+ clearTimeout(timeoutId);
47
+ timeoutId = undefined;
48
+ }
49
+ };
50
+ const result = (...args) => {
51
+ clear();
52
+ timeoutId = setTimeout(() => {
53
+ try {
54
+ const _this = options && options.this ? options.this : null;
55
+ // 由于 Reflect.apply 并不能在 ES5 中使用,所以我们并不能保证能执行成功
56
+ callback.apply(_this, args);
57
+ // Reflect.apply(callback, options?.this ?? null, args);
58
+ }
59
+ catch (error) {
60
+ console.log('Debounce callback throw an error', error);
61
+ }
62
+ }, Math.max(options.delay || 5, 5));
63
+ };
64
+ result.cancel = () => clear();
65
+ return result;
66
+ }
67
+ /**
68
+ * # 节流
69
+ *
70
+ * @param callback 回调函数
71
+ * @param options 延迟时间(毫秒),默认 200 (ms) 或设置 this
72
+ * @returns 返回的闭包函数
73
+ * @example
74
+ *
75
+ * ```ts
76
+ * import { throttle , sleep } form "@mudbean/utils";
77
+ *
78
+ * const a_throttle_fn = throttle(()=> {
79
+ * console.log("hello");
80
+ * }, 1200);
81
+ *
82
+ * a_throttle_fn(); // 正常打印
83
+ * a_throttle_fn(); // 跳过打印
84
+ * await sleep(1200); // 等待 1200ms
85
+ * a_throttle_fn(); // 正常打印
86
+ * a_throttle_fn(); // 跳过打印
87
+ * ```
88
+ */
89
+ function throttle(callback, options = 200) {
90
+ if (!isFunction(callback))
91
+ throw new TypeError('callback must be a function');
92
+ if (isNumber(options))
93
+ options = {
94
+ delay: options,
95
+ this: null,
96
+ };
97
+ if (isUndefined(options.delay) ||
98
+ !isFinite(options.delay) ||
99
+ options.delay < 0)
100
+ // 强制转换非数值
101
+ options.delay = 200;
102
+ /** 延迟控制插销 */
103
+ let inThrottle = false;
104
+ /** 延迟控制 */
105
+ let timeoutId = null;
106
+ const delay = options && options.delay ? options.delay : 5;
107
+ const throttled = (...args) => {
108
+ if (inThrottle)
109
+ return;
110
+ try {
111
+ const _this = options && options.this ? options.this : null;
112
+ callback.apply(_this, args);
113
+ }
114
+ catch (error) {
115
+ console.error('Throttle 执行回调抛出问题', error);
116
+ }
117
+ inThrottle = true;
118
+ if (!isNull(timeoutId))
119
+ clearTimeout(timeoutId);
120
+ timeoutId = setTimeout(() => {
121
+ inThrottle = false;
122
+ timeoutId = null;
123
+ }, Math.max(delay, 5));
124
+ };
125
+ throttled.cancel = () => {
126
+ if (!isNull(timeoutId)) {
127
+ clearTimeout(timeoutId);
128
+ }
129
+ inThrottle = false;
130
+ timeoutId = null;
131
+ };
132
+ return throttled;
133
+ }
134
+
135
+ export { debounce, throttle };
@@ -0,0 +1,28 @@
1
+ import { autoEscapedRegExpOptions } from './types';
2
+ /**
3
+ * # 适用于简单的文本字符串自动转化为简单模式正则表达式
4
+ *
5
+ * *若字符串包含且需保留字符类、组、反向引用、量词等时,该方法可能不适用*
6
+ *
7
+ * @param pattern 待转化的文本字符串
8
+ * @param options 转化选项。 为文本字符串时,默认为正则表达式的标志,还可指定是否匹配开头或结尾
9
+ * @returns 正则表达式
10
+ * @example
11
+ * ```ts
12
+ * import { autoEscapedRegExp } from '@mudbean/utils';
13
+ *
14
+ * autoEscapedRegExp('abc'); // => /abc/
15
+ * autoEscapedRegExp('abc', 'gim'); // => /abc/gim
16
+ * autoEscapedRegExp('abc', { flags: 'g', start: true }); // => /^abc/g
17
+ * autoEscapedRegExp('abc', { flags: 'g', end: true }); // => /abc$/g
18
+ * autoEscapedRegExp('abc', { start: true, end: true }); // => /^abc$/
19
+ *
20
+ * // 转化特殊字符类、组、反向引用、量词等
21
+ * // 无法保留匹配规则
22
+ * autoEscapedRegExp('a-zA-Z0-9'); // => /a-zA-Z0-9/
23
+ * autoEscapedRegExp('a-zA-Z0-9', 'g'); // => /a-zA-Z0-9/g
24
+ * autoEscapedRegExp('[a-zA-Z0-9]'); // => /\[a-zA-Z0-9\]/
25
+ * autoEscapedRegExp('^[a-zA-Z0-9]+$'); // => /\^\[a-zA-Z0-9\]\$/
26
+ * ```
27
+ */
28
+ export declare function autoEscapedRegExp(pattern: string, options?: string | autoEscapedRegExpOptions): RegExp;
@@ -0,0 +1,42 @@
1
+ import { isString, isUndefined } from '@mudbean/is';
2
+ import { escapeRegExp } from './escapeRegExp.js';
3
+ import { parse } from './parse.js';
4
+
5
+ /**
6
+ * # 适用于简单的文本字符串自动转化为简单模式正则表达式
7
+ *
8
+ * *若字符串包含且需保留字符类、组、反向引用、量词等时,该方法可能不适用*
9
+ *
10
+ * @param pattern 待转化的文本字符串
11
+ * @param options 转化选项。 为文本字符串时,默认为正则表达式的标志,还可指定是否匹配开头或结尾
12
+ * @returns 正则表达式
13
+ * @example
14
+ * ```ts
15
+ * import { autoEscapedRegExp } from '@mudbean/utils';
16
+ *
17
+ * autoEscapedRegExp('abc'); // => /abc/
18
+ * autoEscapedRegExp('abc', 'gim'); // => /abc/gim
19
+ * autoEscapedRegExp('abc', { flags: 'g', start: true }); // => /^abc/g
20
+ * autoEscapedRegExp('abc', { flags: 'g', end: true }); // => /abc$/g
21
+ * autoEscapedRegExp('abc', { start: true, end: true }); // => /^abc$/
22
+ *
23
+ * // 转化特殊字符类、组、反向引用、量词等
24
+ * // 无法保留匹配规则
25
+ * autoEscapedRegExp('a-zA-Z0-9'); // => /a-zA-Z0-9/
26
+ * autoEscapedRegExp('a-zA-Z0-9', 'g'); // => /a-zA-Z0-9/g
27
+ * autoEscapedRegExp('[a-zA-Z0-9]'); // => /\[a-zA-Z0-9\]/
28
+ * autoEscapedRegExp('^[a-zA-Z0-9]+$'); // => /\^\[a-zA-Z0-9\]\$/
29
+ * ```
30
+ */
31
+ function autoEscapedRegExp(pattern, options) {
32
+ if (!isString(pattern))
33
+ throw new TypeError('pattern must be a 字符串');
34
+ pattern = escapeRegExp(pattern);
35
+ /** 简单转化 */
36
+ if (isUndefined(options))
37
+ return new RegExp(pattern);
38
+ options = parse(options);
39
+ return new RegExp(`${options.start ? '^' : ''}${pattern}${options.end ? '$' : ''}`, options.flags);
40
+ }
41
+
42
+ export { autoEscapedRegExp };
@@ -0,0 +1,16 @@
1
+ /**
2
+ * # 将一个字符串转化为符合正则要求的字符串
3
+ *
4
+ * @param str 需要转义的字符串
5
+ * @requires escapeRegExp 转化后字符串
6
+ * @example
7
+ * ```ts
8
+ * import { escapeRegExp } from '@mudbean/utils';
9
+ *
10
+ * escapeRegExp('a.b.c'); // 'a\\.b\\.c'
11
+ * escapeRegExp('a\\.b\\.c'); // 'a\\\\.b\\\\.c'
12
+ * escapeRegExp('[a-z]'); // '\\[a-z\\]'
13
+ * escapeRegExp('^abc$'); // '\\^abc\\$'
14
+ * ```
15
+ */
16
+ export declare function escapeRegExp(str: string): string;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * # 将一个字符串转化为符合正则要求的字符串
3
+ *
4
+ * @param str 需要转义的字符串
5
+ * @requires escapeRegExp 转化后字符串
6
+ * @example
7
+ * ```ts
8
+ * import { escapeRegExp } from '@mudbean/utils';
9
+ *
10
+ * escapeRegExp('a.b.c'); // 'a\\.b\\.c'
11
+ * escapeRegExp('a\\.b\\.c'); // 'a\\\\.b\\\\.c'
12
+ * escapeRegExp('[a-z]'); // '\\[a-z\\]'
13
+ * escapeRegExp('^abc$'); // '\\^abc\\$'
14
+ * ```
15
+ */
16
+ function escapeRegExp(str) {
17
+ return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
18
+ }
19
+
20
+ export { escapeRegExp };
@@ -0,0 +1,2 @@
1
+ export { escapeRegExp } from './escapeRegExp';
2
+ export { autoEscapedRegExp } from './autoEscapedRegExp';
@@ -0,0 +1,6 @@
1
+ import type { autoEscapedRegExpOptions } from './types';
2
+ /**
3
+ * # 解析 options
4
+ * @param options
5
+ */
6
+ export declare function parse(options: string | autoEscapedRegExpOptions): autoEscapedRegExpOptions;
@@ -0,0 +1,29 @@
1
+ import { isString, isNull } from '@mudbean/is';
2
+
3
+ /**
4
+ * # 解析 options
5
+ * @param options
6
+ */
7
+ function parse(options) {
8
+ // 处理 options
9
+ if (isString(options)) {
10
+ options = {
11
+ flags: options,
12
+ };
13
+ }
14
+ // 处理 flags
15
+ if (!isString(options.flags))
16
+ options.flags = '';
17
+ else {
18
+ // 需求是保留字符串中的某一部分,使用
19
+ const regexp = /[migsuy]/g;
20
+ const matchResult = options.flags.match(regexp);
21
+ if (isNull(matchResult))
22
+ options.flags = '';
23
+ else
24
+ options.flags = [...new Set(matchResult)].join('');
25
+ }
26
+ return options;
27
+ }
28
+
29
+ export { parse };
@@ -0,0 +1,10 @@
1
+ export interface autoEscapedRegExpOptions {
2
+ /**
3
+ */
4
+ flags?: string;
5
+ /**
6
+ * 匹配开头
7
+ */
8
+ start?: boolean;
9
+ end?: boolean;
10
+ }
package/es/sleep.d.ts ADDED
@@ -0,0 +1,25 @@
1
+ /**
2
+ * # 线程休息
3
+ *
4
+ * 但从调用到执行完毕总是与期望的时间并不相吻合,除非执行是线型的(也不保证时间的严格性)
5
+ *
6
+ * - 宏任务:整体代码、setTimeout、DOM 事件回调、requestAnimationFrame、setImmediate、setInterval、I/O操作、UI渲染等
7
+ * - 微任务:Promise的then/catch/finally、process.nextTick(Node.js)、MutationObserver、queueMicrotask(显示添加微任务)等
8
+ *
9
+ * <span style="color:#ff0;">*Node.js 中的 process.nextTick 优先级高于其他微任务*</span>
10
+ *
11
+ * *如果参数为非法数值,将会抛出 TypeError *
12
+ *
13
+ * @param delay 睡觉时长(机器时间,毫秒为单位)
14
+ * @returns 🈳
15
+ * @example
16
+ *
17
+ * ```ts
18
+ * import { sleep } from '@mudbean/utils';
19
+ *
20
+ * console.log(Date.now()); // 1748058118471
21
+ * await sleep(1000);
22
+ * console.log(Date.now()); // 1748058119473
23
+ * ```
24
+ */
25
+ export declare function sleep(delay?: number): Promise<void>;
package/es/sleep.js ADDED
@@ -0,0 +1,35 @@
1
+ import { isZero } from '@mudbean/is';
2
+
3
+ /**
4
+ * # 线程休息
5
+ *
6
+ * 但从调用到执行完毕总是与期望的时间并不相吻合,除非执行是线型的(也不保证时间的严格性)
7
+ *
8
+ * - 宏任务:整体代码、setTimeout、DOM 事件回调、requestAnimationFrame、setImmediate、setInterval、I/O操作、UI渲染等
9
+ * - 微任务:Promise的then/catch/finally、process.nextTick(Node.js)、MutationObserver、queueMicrotask(显示添加微任务)等
10
+ *
11
+ * <span style="color:#ff0;">*Node.js 中的 process.nextTick 优先级高于其他微任务*</span>
12
+ *
13
+ * *如果参数为非法数值,将会抛出 TypeError *
14
+ *
15
+ * @param delay 睡觉时长(机器时间,毫秒为单位)
16
+ * @returns 🈳
17
+ * @example
18
+ *
19
+ * ```ts
20
+ * import { sleep } from '@mudbean/utils';
21
+ *
22
+ * console.log(Date.now()); // 1748058118471
23
+ * await sleep(1000);
24
+ * console.log(Date.now()); // 1748058119473
25
+ * ```
26
+ */
27
+ async function sleep(delay = 1000) {
28
+ if (!isFinite(delay) || delay < 4)
29
+ throw new TypeError('delay 应该是一个正常的数值');
30
+ if (isZero(delay))
31
+ return Promise.resolve();
32
+ return new Promise(resolve => setTimeout(resolve, delay));
33
+ }
34
+
35
+ export { sleep };
package/package.json ADDED
@@ -0,0 +1,118 @@
1
+ {
2
+ "type": "module",
3
+ "version": "2.0.5",
4
+ "name": "@mudbean/utils",
5
+ "license": "MIT",
6
+ "dependencies": {
7
+ "@mudbean/is": "^2.0.2"
8
+ },
9
+ "main": "cjs/index.js",
10
+ "module": "es/index.js",
11
+ "types": "es/index.d.ts",
12
+ "author": {
13
+ "name": "泥豆君",
14
+ "email": "Mr.MudBean@outlook.com",
15
+ "url": "https://mudbean.cn"
16
+ },
17
+ "description": "一点点 🤏 js 函数",
18
+ "sideEffects": false,
19
+ "engines": {
20
+ "node": ">=18.0.0"
21
+ },
22
+ "files": [
23
+ "es",
24
+ "cjs",
25
+ "CHANGELOG.md",
26
+ "LICENSE",
27
+ "README.md"
28
+ ],
29
+ "exports": {
30
+ ".": {
31
+ "import": "./es/index.js",
32
+ "default": "./es/index.js",
33
+ "require": "./cjs/index.js",
34
+ "types": "./es/index.d.ts"
35
+ },
36
+ "./array": {
37
+ "default": "./es/array/index.js",
38
+ "import": "./es/array/index.js",
39
+ "require": "./cjs/array/index.js",
40
+ "types": "./es/array/index.d.ts"
41
+ },
42
+ "./className": {
43
+ "default": "./es/className.js",
44
+ "import": "./es/className.js",
45
+ "require": "./cjs/className.js",
46
+ "types": "./es/className.d.ts"
47
+ },
48
+ "./createBezier": {
49
+ "default": "./es/createBezier.js",
50
+ "import": "./es/createBezier.js",
51
+ "require": "./cjs/createBezier.js",
52
+ "types": "./es/createBezier.d.ts"
53
+ },
54
+ "./getRandomNumber": {
55
+ "default": "./es/getRandomNumber.js",
56
+ "import": "./es/getRandomNumber.js",
57
+ "require": "./cjs/getRandomNumber.js",
58
+ "types": "./es/getRandomNumber.d.ts"
59
+ },
60
+ "./getRandomString": {
61
+ "default": "./es/getRandomString.js",
62
+ "import": "./es/getRandomString.js",
63
+ "require": "./cjs/getRandomString.js",
64
+ "types": "./es/getRandomString.d.ts"
65
+ },
66
+ "./isNode": {
67
+ "default": "./es/isNode.js",
68
+ "import": "./es/isNode.js",
69
+ "require": "./cjs/isNode.js",
70
+ "types": "./es/isNode.d.ts"
71
+ },
72
+ "./object": {
73
+ "default": "./es/object/index.js",
74
+ "import": "./es/object/index.js",
75
+ "require": "./cjs/object/index.js",
76
+ "types": "./es/object/index.d.ts"
77
+ },
78
+ "./performance": {
79
+ "default": "./es/performance.js",
80
+ "import": "./es/performance.js",
81
+ "require": "./cjs/performance.js",
82
+ "types": "./es/performance.d.ts"
83
+ },
84
+ "./regexp": {
85
+ "default": "./es/regexp/index.js",
86
+ "import": "./es/regexp/index.js",
87
+ "require": "./cjs/regexp/index.js",
88
+ "types": "./es/regexp/index.d.ts"
89
+ },
90
+ "./sleep": {
91
+ "default": "./es/sleep.js",
92
+ "import": "./es/sleep.js",
93
+ "require": "./cjs/sleep.js",
94
+ "types": "./es/sleep.d.ts"
95
+ }
96
+ },
97
+ "repository": {
98
+ "type": "git",
99
+ "url": "git+https://github.com/MrMudBean/utils.git"
100
+ },
101
+ "keywords": [
102
+ "js utils",
103
+ "js 工具",
104
+ "mudbean"
105
+ ],
106
+ "homepage": "https://npm.lmssee.cn/utils",
107
+ "bugs": {
108
+ "url": "https://github.com/MrMudBean/utils/issues",
109
+ "email": "Mr.MudBean@outlook.com"
110
+ },
111
+ "publishConfig": {
112
+ "access": "public",
113
+ "registry": "https://registry.npmjs.org/"
114
+ },
115
+ "browserslist": [
116
+ "last 2 versions not ie <= 11"
117
+ ]
118
+ }