lyb-js 1.1.5 → 1.1.7

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 (83) hide show
  1. package/README.md +110 -47
  2. package/dist/Base/LibJsGetDataType/index.d.ts +1 -5
  3. package/dist/Base/LibJsGetDataType/index.js +2 -6
  4. package/dist/Base/LibJsPromiseTimeout/index.d.ts +1 -5
  5. package/dist/Base/LibJsPromiseTimeout/index.js +12 -15
  6. package/dist/Browser/LibJsColorConsole/index.d.ts +1 -7
  7. package/dist/Browser/LibJsColorConsole/index.js +23 -19
  8. package/dist/Browser/LibJsIsMobile/index.d.ts +1 -4
  9. package/dist/Browser/LibJsIsMobile/index.js +3 -6
  10. package/dist/Browser/LibJsIsPad/index.d.ts +1 -4
  11. package/dist/Browser/LibJsIsPad/index.js +9 -12
  12. package/dist/Browser/LibJsObjToUrlParams/index.d.ts +1 -4
  13. package/dist/Browser/LibJsObjToUrlParams/index.js +6 -6
  14. package/dist/Browser/LibJsPathParams/index.d.ts +1 -4
  15. package/dist/Browser/LibJsPathParams/index.js +6 -9
  16. package/dist/Browser/LibJsSetTitleIcon/index.d.ts +1 -3
  17. package/dist/Browser/LibJsSetTitleIcon/index.js +4 -6
  18. package/dist/Browser/LibJsTagTitleTip/index.d.ts +1 -3
  19. package/dist/Browser/LibJsTagTitleTip/index.js +6 -8
  20. package/dist/Data/LibJsChunkArray/index.d.ts +1 -4
  21. package/dist/Data/LibJsChunkArray/index.js +4 -7
  22. package/dist/Data/LibJsDeepJSONParse/index.d.ts +1 -4
  23. package/dist/Data/LibJsDeepJSONParse/index.js +6 -9
  24. package/dist/Data/LibJsGroupArrayByKey/index.d.ts +1 -4
  25. package/dist/Data/LibJsGroupArrayByKey/index.js +4 -6
  26. package/dist/Data/LibJsMatchEmail/index.d.ts +1 -4
  27. package/dist/Data/LibJsMatchEmail/index.js +5 -8
  28. package/dist/Data/LibJsShuffleArray/index.d.ts +1 -4
  29. package/dist/Data/LibJsShuffleArray/index.js +16 -9
  30. package/dist/Data/LibJsStepArray/index.d.ts +1 -4
  31. package/dist/Data/LibJsStepArray/index.js +4 -7
  32. package/dist/Data/LibReverseArrayFromIndex/index.d.ts +1 -4
  33. package/dist/Data/LibReverseArrayFromIndex/index.js +13 -7
  34. package/dist/File/LibJsDownloadImageLink/index.d.ts +1 -3
  35. package/dist/File/LibJsDownloadImageLink/index.js +6 -8
  36. package/dist/File/LibJsImageOptimizer/index.d.ts +1 -14
  37. package/dist/File/LibJsImageOptimizer/index.js +37 -50
  38. package/dist/File/LibJsSaveJson/index.d.ts +1 -4
  39. package/dist/File/LibJsSaveJson/index.js +5 -8
  40. package/dist/Formatter/LibJsFormatterByte/index.d.ts +1 -4
  41. package/dist/Formatter/LibJsFormatterByte/index.js +7 -10
  42. package/dist/Formatter/LibJsMaskPhoneNumber/index.d.ts +1 -4
  43. package/dist/Formatter/LibJsMaskPhoneNumber/index.js +3 -6
  44. package/dist/Formatter/LibJsNumComma/index.d.ts +1 -4
  45. package/dist/Formatter/LibJsNumComma/index.js +5 -7
  46. package/dist/Formatter/LibJsNumberUnit/index.d.ts +6 -9
  47. package/dist/Formatter/LibJsNumberUnit/index.js +18 -14
  48. package/dist/Formatter/LibJsSecondsFormatterChinese/index.d.ts +1 -6
  49. package/dist/Formatter/LibJsSecondsFormatterChinese/index.js +16 -21
  50. package/dist/Math/LibJsCalculateExpression/index.d.ts +1 -4
  51. package/dist/Math/LibJsCalculateExpression/index.js +33 -32
  52. package/dist/Math/LibJsConvertAngle/index.d.ts +1 -7
  53. package/dist/Math/LibJsConvertAngle/index.js +2 -8
  54. package/dist/Math/LibJsCoordsAngle/index.d.ts +1 -5
  55. package/dist/Math/LibJsCoordsAngle/index.js +6 -10
  56. package/dist/Math/LibJsCoordsDistance/index.d.ts +1 -5
  57. package/dist/Math/LibJsCoordsDistance/index.js +5 -9
  58. package/dist/Math/LibJsDecimal/index.d.ts +1 -5
  59. package/dist/Math/LibJsDecimal/index.js +9 -12
  60. package/dist/Misc/LibJsRegFormValidate/index.d.ts +1 -16
  61. package/dist/Misc/LibJsRegFormValidate/index.js +7 -22
  62. package/dist/Misc/LibJsRetryRequest/index.d.ts +1 -12
  63. package/dist/Misc/LibJsRetryRequest/index.js +8 -18
  64. package/dist/Misc/LibNumerStepper/index.d.ts +1 -6
  65. package/dist/Misc/LibNumerStepper/index.js +28 -35
  66. package/dist/Random/LibJsProbabilityResult/index.d.ts +1 -5
  67. package/dist/Random/LibJsProbabilityResult/index.js +4 -6
  68. package/dist/Random/LibJsRandom/index.d.ts +1 -4
  69. package/dist/Random/LibJsRandom/index.js +3 -5
  70. package/dist/Random/LibJsRandomColor/index.d.ts +1 -4
  71. package/dist/Random/LibJsRandomColor/index.js +7 -9
  72. package/dist/Random/LibJsUniqueRandomNumbers/index.d.ts +1 -4
  73. package/dist/Random/LibJsUniqueRandomNumbers/index.js +7 -9
  74. package/dist/Time/LibJsSameTimeCheck/index.d.ts +1 -5
  75. package/dist/Time/LibJsSameTimeCheck/index.js +4 -8
  76. package/dist/Time/LibJsTimeAgo/index.d.ts +1 -6
  77. package/dist/Time/LibJsTimeAgo/index.js +9 -13
  78. package/dist/Time/LibJsTimeGreeting/index.d.ts +1 -5
  79. package/dist/Time/LibJsTimeGreeting/index.js +5 -8
  80. package/dist/libJs.d.ts +42 -201
  81. package/dist/libJs.js +95 -256
  82. package/package.json +1 -1
  83. package/umd/lyb.js +3 -3
package/dist/libJs.d.ts CHANGED
@@ -4,22 +4,14 @@ export declare const Base: {
4
4
  /**
5
5
  * @description 返回数据类型
6
6
  * @param v 需要判断类型的数据
7
- * @link 了解更多:https://www.npmjs.com/package/lyb-js
8
- * @example
9
- * libJsGetDataType(123); //"number"
10
- * libJsGetDataType("hello"); //"string"
11
- * libJsGetDataType([1, 2, 3]); //"array"
7
+ * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsColorConsole-有色打印
12
8
  */
13
9
  libJsGetDataType: (v: any) => import("./Base/LibJsGetDataType").LibJsGetDataTypeReturnType;
14
10
  /**
15
11
  * @description 延时执行,切换到其他页面会暂停
16
12
  * @param delay 延时毫秒数
17
13
  * @param fn 延时执行函数
18
- * @link 了解更多:https://www.npmjs.com/package/lyb-js
19
- * @example
20
- * libJsPromiseTimeout(3000, () => {
21
- * console.log("执行延时函数");
22
- * });
14
+ * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsPromiseTimeout-延时执行
23
15
  */
24
16
  libJsPromiseTimeout: (delay?: number, fn?: () => void) => Promise<void>;
25
17
  };
@@ -29,61 +21,39 @@ export declare const Browser: {
29
21
  * @param title 标题
30
22
  * @param color 颜色
31
23
  * @param logs 信息
32
- * @link 了解更多:https://www.npmjs.com/package/lyb-js
33
- * @example
34
- * //使用红色打印日志
35
- * libJsColorConsole("错误提示", "red", [{ label: "错误代码", value: 500 }]);
36
- *
37
- * //使用蓝色打印简单日志
38
- * libJsColorConsole("信息", "blue", "操作成功");
24
+ * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsColorConsole-有色打印
39
25
  */
40
26
  libJsColorConsole: (title: string, color: "red" | "orange" | "yellow" | "green" | "blue" | "purple", logs?: {
41
27
  label: string;
42
28
  value: any;
43
29
  }[] | any) => void;
44
30
  /** @description 判断是否为移动设备
45
- * @link 了解更多:https://www.npmjs.com/package/lyb-js
46
- * @example
47
- * const isMobile = libJsIsMobile();
48
- * console.log(isMobile); //true 或 false
31
+ * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsIsMobile-判断手机
49
32
  */
50
33
  libJsIsMobile: () => boolean;
51
34
  /** @description 判断是否为平板
52
- * @link 了解更多:https://www.npmjs.com/package/lyb-js
53
- * @example
54
- * const isPad = libJsIsPad();
55
- * console.log(isPad); //true 或 false
35
+ * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsIsPad-判断平板
56
36
  */
57
37
  libJsIsPad: () => boolean;
58
38
  /** @description 获取浏览器地址栏参数
59
- * @link 了解更多:https://www.npmjs.com/package/lyb-js
60
- * @example
61
- * const params = libJsPathParams();
62
- * console.log(params); //{ param1: "value1", param2: "value2" }
39
+ * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsPathParams-地址栏参数
63
40
  */
64
41
  libJsPathParams: () => Record<string, string>;
65
42
  /** @description 动态设置网站标题及图标
66
43
  * @param title 网站标题
67
44
  * @param url 网站图标地址
68
- * @link 了解更多:https://www.npmjs.com/package/lyb-js
69
- * @example
70
- * libJsSetTitleIcon("我的网站", "https://example.com/favicon.ico");
45
+ * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsSetTitleIcon-网站标题图标
71
46
  */
72
47
  libJsSetTitleIcon: (title: string, url: string) => void;
73
48
  /** @description 网站标题交互,当从当前网页切换到其他网页,网站标题自动切换
74
49
  * @param backTitle 从其他网页返回时显示的标题
75
50
  * @param leaveTitle 从当前网页离开时显示的标题
76
- * * @link 了解更多:https://www.npmjs.com/package/lyb-js
77
- * @example
78
- * libJsTagTitleTip("欢迎回来", "来和妲己玩耍吧!");
51
+ * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsTagTitleTip-网站标题交互
79
52
  */
80
53
  libJsTagTitleTip: (backTitle: string, leaveTitle: string) => void;
81
54
  /** @description 对象转为url参数
82
55
  * @param params 对象参数
83
- * @link 了解更多:https://www.npmjs.com/package/lyb-js
84
- * @example
85
- * libJsObjToUrlParams({ name: "John", age: 30, active: true });
86
- * // "name=John&age=30&active=true"
56
+ * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsObjToUrlParams-对象转Url参数
87
57
  */
88
58
  libJsObjToUrlParams: (params: Record<string, string | number | boolean>) => string;
89
59
  };
@@ -93,17 +63,11 @@ export declare const Data: {
93
63
  * @description 将数组拆分成指定数组元素数量的多个数组
94
64
  * @param arr 需要拆分的数组
95
65
  * @param chunkSize 每个数组的元素数量
96
- * @link 了解更多:https://www.npmjs.com/package/lyb-js
97
- * @example
98
- * const chunks = libJsChunkArray([1, 2, 3, 4, 5, 6], 2);
99
- * console.log(chunks); //[[1, 2], [3, 4], [5, 6]]
66
+ * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsChunkArray-数组拆分
100
67
  */
101
68
  libJsChunkArray: <T>(arr: T[], chunkSize: number) => T[][];
102
69
  /** @description 递归将JSON字符串深度解析为对象
103
- * @link 了解更多:https://www.npmjs.com/package/lyb-js
104
- * @example
105
- * const obj = libJsDeepJSONParse('{"a": 1, "b": "{\"c\": 2}"}');
106
- * console.log(obj); //{ a: 1, b: { c: 2 } }
70
+ * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsDeepJSONParse-深度解析JSON
107
71
  */
108
72
  libJsDeepJSONParse: <T>(data: any) => T;
109
73
  /**
@@ -111,10 +75,7 @@ export declare const Data: {
111
75
  * @param arr 要分组的数组
112
76
  * @param key 分组的键
113
77
  * @returns 分组后的对象
114
- * @link 了解更多:https://www.npmjs.com/package/lyb-js
115
- * @example
116
- * const grouped = libJsGroupArrayByKey([{ id: 1, name: 'A' }, { id: 2, name: 'B' }, { id: 1, name: 'C' }], 'id');
117
- * console.log(grouped); //{ 1: [{ id: 1, name: 'A' }, { id: 1, name: 'C' }], 2: [{ id: 2, name: 'B' }] }
78
+ * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsGroupArrayByKey-分类汇总
118
79
  */
119
80
  libJsGroupArrayByKey: (arr: any[] | undefined, key: string) => any;
120
81
  /**
@@ -122,36 +83,24 @@ export declare const Data: {
122
83
  * @param str 要匹配的字符串
123
84
  * @param emailList 电子邮件后缀列表
124
85
  * @returns 匹配结果数组
125
- * @link 了解更多:https://www.npmjs.com/package/lyb-js
126
- * @example
127
- * const emails = libJsMatchEmail("user", ["@gmail.com", "@yahoo.com"]);
128
- * console.log(emails); //["user@gmail.com", "user@yahoo.com"]
86
+ * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsMatchEmail-匹配E-Mail
129
87
  */
130
88
  libJsMatchEmail: (str: string, emailList: string[]) => string[];
131
89
  /** @description 数组乱序
132
90
  * @param arr 需要乱序的数组
133
- * @link 了解更多:https://www.npmjs.com/package/lyb-js
134
- * @example
135
- * const shuffled = libJsShuffleArray([1, 2, 3, 4, 5]);
136
- * console.log(shuffled); //[3, 5, 2, 1, 4] (结果每次不同)
91
+ * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsShuffleArray-数组乱序
137
92
  */
138
93
  libJsShuffleArray: <T>(arr: T[]) => T[];
139
94
  /** @description 数组元素整体步数移动
140
95
  * @param arr 移动的数组
141
96
  * @param step 负数为向后移动,正数为向前移动
142
- * @link 了解更多:https://www.npmjs.com/package/lyb-js
143
- * @example
144
- * const moved = libJsStepArray([1, 2, 3, 4, 5], 2);
145
- * console.log(moved); //[4, 5, 1, 2, 3]
97
+ * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsStepArray-数组偏移
146
98
  */
147
99
  libJsStepArray: <T>(arr: T[], step: number) => T[];
148
100
  /** @description 翻转指定索引后面的数组
149
101
  * @param arr 数组
150
102
  * @param index 开始索引
151
- * @link 了解更多:https://www.npmjs.com/package/lyb-js
152
- * @example
153
- * libReverseArrayFromIndex([1, 2, 3, 4, 5], 1);
154
- * // [1, 2, 5, 4, 3]
103
+ * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibReverseArrayFromIndex-数组定位翻转
155
104
  */
156
105
  libReverseArrayFromIndex: <T>(arr: T[], index: number) => T[];
157
106
  };
@@ -160,37 +109,19 @@ export declare const File: {
160
109
  /** @description 下载图片链接
161
110
  * @param link 图片链接
162
111
  * @param name 图片名称
163
- * @link 了解更多:https://www.npmjs.com/package/lyb-js
164
- * @example
165
- * libJsDownloadImageLink("https://example.com/image.jpg", "downloaded-image.jpg");
112
+ * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsDownloadImageLink-图片下载
166
113
  */
167
114
  libJsDownloadImageLink: (link: string, name: string) => void;
168
115
  /** @description 图片压缩
169
116
  * @param obj 压缩参数
170
- * @link 了解更多:https://www.npmjs.com/package/lyb-js
171
- * @example
172
- * //图片压缩使用示例
173
- * libJsImageOptimizerOptionsParams({
174
- * file: myFile,
175
- * ratio: 0.8,
176
- * width: 800,
177
- * maxSize: 1024,
178
- * success: (data, file, url) => {
179
- * console.log('压缩成功', data, file, url);
180
- * },
181
- * fail: (error) => {
182
- * console.error('压缩失败', error);
183
- * }
184
- * });
117
+ * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsImageOptimizer-图片压缩
185
118
  */
186
119
  libJsImageOptimizer: (obj: import("./File/LibJsImageOptimizer").LibJsImageOptimizerOptionsParams) => void;
187
120
  /**
188
121
  * @description 保存文件到本地
189
122
  * @param data 要保存的数据
190
123
  * @param name 文件名
191
- * @link 了解更多:https://www.npmjs.com/package/lyb-js
192
- * @example
193
- * libJsSaveJson("example.json", JSON.stringify({ key: "value" }));
124
+ * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsSaveJson-保存文件
194
125
  */
195
126
  libJsSaveJson: (name: string, data: BlobPart) => void;
196
127
  };
@@ -200,51 +131,36 @@ export declare const Formatter: {
200
131
  * @description 格式化字节大小
201
132
  * @param bytes 字节数
202
133
  * @returns ['大小', '单位', '大小及单位']
203
- * @link 了解更多:https://www.npmjs.com/package/lyb-js
204
- * @example
205
- * const [size, unit, formatted] = libJsFormatterByte(2048);
206
- * console.log(size, unit, formatted); //2.00 KB 2.00 KB
134
+ * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsFormatterByte-字节格式化
207
135
  */
208
136
  libJsFormatterByte: (bytes: number) => (string | number)[];
209
137
  /**
210
138
  * @description 隐藏手机号码中间的四位数字
211
139
  * @param mobile 需要处理的手机号码
212
- * @link 了解更多:https://www.npmjs.com/package/lyb-js
213
- * @example
214
- * const masked = libJsMaskPhoneNumber("13812345678");
215
- * console.log(masked); //138****5678
140
+ * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsMaskPhoneNumber-隐藏手机号码
216
141
  */
217
142
  libJsMaskPhoneNumber: (mobile: number | string) => string;
218
143
  /**
219
144
  * @description 数字每三位添加逗号
220
145
  * @param num 需要格式化的数字
221
146
  * @param reserve 保留小数位数
222
- * @link 了解更多:https://www.npmjs.com/package/lyb-js
223
- * @example
224
- * const formatted = libJsNumComma(1234567.89);
225
- * console.log(formatted); //1,234,567.89
147
+ * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsNumComma-数字逗号
226
148
  */
227
149
  libJsNumComma: (num: number, reserve?: number) => string;
228
150
  /** @description 将大于1000的数字使用k为单位
229
151
  * @param num 数字
230
152
  * @param units 单位组,key为单位,value为格式化阈值
231
153
  * @returns [数字, 单位]
232
- * @link 了解更多:https://www.npmjs.com/package/lyb-js
233
- * @example
234
- * const [value, unit] = libJsNumberUnit(1500, { K: 1000, M: 1000000 });
235
- * console.log(value, unit); //1.50 K
154
+ * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsNumberUnit-数字单位
236
155
  */
237
- libJsNumberUnit: (num: number, units: import("./Formatter/LibJsNumberUnit").LibJsNumberUnitParams) => string[];
156
+ libJsNumberUnit: (num: number, units: {
157
+ string: number;
158
+ }, point?: number) => string[];
238
159
  /**
239
160
  * @description 将秒数格式化为中文时间描述,支持扩展到年和月
240
161
  * @param seconds 秒数
241
162
  * @returns 格式化后的中文时间
242
- * @link 了解更多:https://www.npmjs.com/package/lyb-js
243
- * @example
244
- * libJsSecondsFormatterChinese(100000); //"1天3小时46分40秒"
245
- * libJsSecondsFormatterChinese(31536000); //"1年"
246
- * libJsSecondsFormatterChinese(3600); //"1小时"
247
- * libJsSecondsFormatterChinese(90); //"1分30秒"
163
+ * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsSecondsFormatterChinese-中文时间
248
164
  */
249
165
  libJsSecondsFormatterChinese: (seconds: number) => string;
250
166
  };
@@ -254,34 +170,20 @@ export declare const Math: {
254
170
  * @param expression 表达式字符串
255
171
  * @param point 小数点精度
256
172
  * @returns 计算结果
257
- *
258
- * @link 了解更多:https://www.npmjs.com/package/lyb-js
259
- * @example
260
- * const result = libJsCalculateExpression("(1+2)-(3*4)/5");
261
- * console.log(result); //0.6
173
+ * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsCalculateExpression-表达式字符串
262
174
  */
263
175
  libJsCalculateExpression: (expression: string, point?: number) => number;
264
176
  /**
265
177
  * @description 角度和弧度互相转换
266
178
  * @param value 角度值或弧度值
267
179
  * @param type 角度类型或弧度类型
268
- * @link 了解更多:https://www.npmjs.com/package/lyb-js
269
- * @example
270
- * //角度转弧度
271
- * libJsConvertAngle(90, "rad"); //返回 1.5708... (π/2)
272
- *
273
- * //弧度转角度
274
- * libJsConvertAngle(Math.PI, "deg"); //返回 180
180
+ * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsConvertAngle-角弧度互转
275
181
  */
276
182
  libJsConvertAngle: (value: number, type: "rad" | "deg") => number;
277
183
  /** @description 计算两点角度
278
184
  * @param coord1 起点坐标
279
185
  * @param coord2 终点坐标
280
- * @link 了解更多:https://www.npmjs.com/package/lyb-js
281
- * @example
282
- * libJsCoordsAngle({ x: 0, y: 0 }, { x: 1, y: 0 }); //0
283
- * libJsCoordsAngle({ x: 0, y: 0 }, { x: 1, y: 1 }); //45
284
- * libJsCoordsAngle({ x: 0, y: 0 }, { x: 0, y: 1 }); //90
186
+ * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsCoordsAngle-两点角度
285
187
  */
286
188
  libJsCoordsAngle: (coord1: {
287
189
  x: number;
@@ -293,11 +195,7 @@ export declare const Math: {
293
195
  /** @description 计算两点距离
294
196
  * @param coord1 起点坐标
295
197
  * @param coord2 终点坐标
296
- * @link 了解更多:https://www.npmjs.com/package/lyb-js
297
- * @example
298
- * libJsCoordsDistance({ x: 0, y: 0 }, { x: 3, y: 4 }); //5
299
- * libJsCoordsDistance({ x: 1, y: 1 }, { x: 4, y: 5 }); //5
300
- * libJsCoordsDistance({ x: 0, y: 0 }, { x: 0, y: 0 }); //0
198
+ * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsCoordsDistance-两点距离
301
199
  */
302
200
  libJsCoordsDistance: (coord1: {
303
201
  x: number;
@@ -310,11 +208,7 @@ export declare const Math: {
310
208
  * @param num1 第一个数
311
209
  * @param num2 第二个数
312
210
  * @param operator 运算符,支持加减乘除
313
- * @link 了解更多:https://www.npmjs.com/package/lyb-js
314
- * @example
315
- * libJsDecimal(10, 3, "+"); //13
316
- * libJsDecimal(10, 3, "-"); //7
317
- * libJsDecimal(10, 3, "/", 2); //3.33
211
+ * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsDecimal-高精度计算
318
212
  */
319
213
  libJsDecimal: (num1: number, num2: number, operator: "+" | "-" | "*" | "/", point?: number) => number;
320
214
  };
@@ -325,22 +219,7 @@ export declare const Misc: {
325
219
  * @param form 表单数据对象
326
220
  * @param rules 验证规则数组
327
221
  * @returns 验证结果数组,包含未通过验证的项
328
- * @link 了解更多:https://www.npmjs.com/package/lyb-js
329
- * @example
330
- * const form = { username: "john", email: "john@example.com" };
331
- * const rules = [
332
- * { key: "username", verify: /^[a-zA-Z0-9]{3,}$/, msg: "用户名不合法", name: "用户名" },
333
- * { key: "email", verify: /^\S+@\S+\.\S+$/, msg: "邮箱格式不正确", name: "邮箱" },
334
- * ];
335
- * libJsRegFormValidate(form, rules);
336
- * //返回结果: []
337
- *
338
- * const invalidForm = { username: "jo", email: "invalid-email" };
339
- * libJsRegFormValidate(invalidForm, rules);
340
- * //返回结果: [
341
- * // { key: "username", msg: "用户名不合法", name: "用户名" },
342
- * // { key: "email", msg: "邮箱格式不正确", name: "邮箱" }
343
- * //]
222
+ * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsRegFormValidate-表单验证
344
223
  */
345
224
  libJsRegFormValidate: (form: Record<string, any>, rules: Array<{
346
225
  key: string;
@@ -353,18 +232,7 @@ export declare const Misc: {
353
232
  * @param maxRetries 最大重试次数
354
233
  * @param retryDelay 重试间隔时间
355
234
  * @param params 请求参数
356
- * @link 了解更多:https://www.npmjs.com/package/lyb-js
357
- * @example
358
- * const requestFn = (params: { url: string }) => fetch(params.url).then(res => res.json());
359
- * const params = { url: "https://api.example.com/data" };
360
- * libJsRetryRequest({
361
- * promiseFn: requestFn,
362
- * params,
363
- * maxRetries: 5,
364
- * retryDelay: 1000
365
- * })
366
- * .then(data => console.log(data))
367
- * .catch(err => console.error(err));
235
+ * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsRetryRequest-请求重连
368
236
  */
369
237
  libJsRetryRequest: <T>({ promiseFn, maxRetries, retryDelay, params, }: {
370
238
  promiseFn: (params?: any) => Promise<T>;
@@ -374,12 +242,7 @@ export declare const Misc: {
374
242
  onRetry?: () => void;
375
243
  }) => Promise<T>;
376
244
  /** @description 数字步进器
377
- * @link 了解更多:https://www.npmjs.com/package/lyb-js
378
- * @example
379
- * const stepper = new libNumerStepper(10, (index) => console.log(index));
380
- * stepper.down("add"); // 索引加1
381
- * stepper.updateIndex(5); // 更新索引为5
382
- * stepper.down("sub"); // 索引减1
245
+ * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibNumerStepper-数字步进器
383
246
  */
384
247
  libNumerStepper: typeof libNumerStepper;
385
248
  };
@@ -387,40 +250,26 @@ export declare const Misc: {
387
250
  export declare const Random: {
388
251
  /** @description 百分比概率结果
389
252
  * @param probability 触发概率,百分比,0-100
390
- * @link 了解更多:https://www.npmjs.com/package/lyb-js
391
- * @example
392
- * libJsProbabilityResult(50); //50% 概率为 true
393
- * libJsProbabilityResult(80); //80% 概率为 true
394
- * libJsProbabilityResult(100); //100% 概率为 true
253
+ * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsProbabilityResult-概率触发
395
254
  */
396
255
  libJsProbabilityResult: (probability: number) => boolean;
397
256
  /** @description 随机数
398
257
  * @param min 最小值
399
258
  * @param max 最大值
400
259
  * @param num 保留小数位数
401
- * @link 了解更多:https://www.npmjs.com/package/lyb-js
402
- * @example
403
- * libJsRandom(1, 10); //1 到 10 之间的随机整数
404
- * libJsRandom(1, 10, 2); //1 到 10 之间保留两位小数的随机数
405
- * libJsRandom(5, 5, 3); //返回 5.000
260
+ * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsRandom-随机数
406
261
  */
407
262
  libJsRandom: (min: number, max: number, num?: number) => number;
408
263
  /** @description 随机 RGBA 颜色
409
264
  * @param alpha 透明度
410
- * @link 了解更多:https://www.npmjs.com/package/lyb-js
411
- * @example
412
- * libJsRandomColor(); //生成随机的 RGBA 颜色,默认透明度 1
413
- * libJsRandomColor(0.5); //生成随机的 RGBA 颜色,透明度为 0.5
265
+ * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsRandomColor-随机色
414
266
  */
415
267
  libJsRandomColor: (alpha?: number) => string;
416
268
  /** @description 随机生成n个指定范围的随机数数组
417
269
  * @param min 最小值
418
270
  * @param max 最大值
419
271
  * @param count 数组长度
420
- * @link 了解更多:https://www.npmjs.com/package/lyb-js
421
- * @example
422
- * libJsUniqueRandomNumbers(1, 10, 5); //从 1 到 10 中随机生成 5 个唯一数字
423
- * libJsUniqueRandomNumbers(1, 100, 10); //从 1 到 100 中随机生成 10 个唯一数字
272
+ * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsUniqueRandomNumbers-随机数数组
424
273
  */
425
274
  libJsUniqueRandomNumbers: (min: number, max: number, count: number) => number[];
426
275
  };
@@ -431,26 +280,18 @@ export declare const Time: {
431
280
  * @param timestamp 毫秒时间戳
432
281
  * @param unit 判断单位
433
282
  * @returns 0-同一单位时间 1-新单位时间 -1时间戳大于当前时间
283
+ * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsSameTimeCheck-时间比对
434
284
  */
435
285
  libJsSameTimeCheck: (timestamp: number, unit: import("dayjs").OpUnitType) => 0 | 1 | -1;
436
286
  /** @description 时间差计算
437
287
  * @param timestamp 毫秒时间戳
438
- * @link 了解更多:https://www.npmjs.com/package/lyb-js
439
- * @example
440
- * libJsTimeAgotamp(Date.now() - 3600000); //"1 小时前"
441
- * libJsTimeAgotamp(Date.now() - 86400000); //"1 天前"
442
- * libJsTimeAgotamp(Date.now() - 31536000000); //"1 年前"
443
- * libJsTimeAgotamp(Date.now() - 10000); //"刚刚"
288
+ * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsTimeAgo-中文时间差
444
289
  */
445
290
  libJsTimeAgo: (timestamp: number) => string;
446
291
  /**
447
292
  * @description 根据当前时间返回问候语
448
293
  * @param greet 自定义问候语对象
449
- * @link 了解更多:https://www.npmjs.com/package/lyb-js
450
- * @example
451
- * libJsTimeGreeting(); //根据当前时间返回默认问候语
452
- * libJsTimeGreeting({ morning: "早安" }); //自定义早上问候语
453
- * libJsTimeGreeting({ afternoon: "午后好" }); //自定义下午问候语
294
+ * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsTimeGreeting-时间问候
454
295
  */
455
296
  libJsTimeGreeting: (greet?: import("./Time/LibJsTimeGreeting").LibTimeGreetingParams) => string;
456
297
  };