lyb-js 1.1.11 → 1.2.1

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 (44) hide show
  1. package/dist/Base/LibJsGetDataType/index.js +1 -1
  2. package/dist/Base/LibJsPromiseTimeout/index.js +9 -10
  3. package/dist/Browser/LibJsColorConsole/index.js +12 -22
  4. package/dist/Browser/LibJsIsMobile/index.js +2 -2
  5. package/dist/Browser/LibJsIsPad/index.js +8 -8
  6. package/dist/Browser/LibJsObjToUrlParams/index.js +2 -5
  7. package/dist/Browser/LibJsPathParams/index.js +5 -5
  8. package/dist/Browser/LibJsSetTitleIcon/index.js +3 -3
  9. package/dist/Browser/LibJsTagTitleTip/index.js +5 -5
  10. package/dist/Data/LibJsChunkArray/index.js +3 -3
  11. package/dist/Data/LibJsDeepJSONParse/index.js +4 -4
  12. package/dist/Data/LibJsGroupArrayByKey/index.js +2 -3
  13. package/dist/Data/LibJsMatchEmail/index.js +4 -4
  14. package/dist/Data/LibJsShuffleArray/index.js +5 -15
  15. package/dist/Data/LibJsStepArray/index.js +3 -3
  16. package/dist/Data/LibReverseArrayFromIndex/index.js +3 -12
  17. package/dist/File/LibJsDownloadImageLink/index.js +5 -5
  18. package/dist/File/LibJsImageOptimizer/index.js +36 -36
  19. package/dist/File/LibJsSaveJson/index.js +4 -4
  20. package/dist/Formatter/LibJsFormatterByte/index.js +6 -6
  21. package/dist/Formatter/LibJsMaskPhoneNumber/index.js +2 -2
  22. package/dist/Formatter/LibJsNumComma/index.js +3 -4
  23. package/dist/Formatter/LibJsNumberUnit/index.js +9 -15
  24. package/dist/Formatter/LibJsSecondsFormatterChinese/index.js +15 -15
  25. package/dist/Math/LibJsCalculateExpression/index.js +17 -19
  26. package/dist/Math/LibJsConvertAngle/index.js +1 -1
  27. package/dist/Math/LibJsCoordsAngle/index.js +5 -5
  28. package/dist/Math/LibJsCoordsDistance/index.js +4 -4
  29. package/dist/Math/LibJsDecimal/index.js +7 -8
  30. package/dist/Misc/LibJsRegFormValidate/index.js +6 -6
  31. package/dist/Misc/LibJsRetryRequest/index.js +6 -7
  32. package/dist/Misc/LibNumerStepper/index.js +17 -21
  33. package/dist/Random/LibJsProbabilityResult/index.js +1 -3
  34. package/dist/Random/LibJsRandom/index.js +1 -2
  35. package/dist/Random/LibJsRandomColor/index.js +5 -6
  36. package/dist/Random/LibJsUniqueRandomNumbers/index.js +5 -6
  37. package/dist/Time/LibJsSameTimeCheck/index.d.ts +1 -1
  38. package/dist/Time/LibJsSameTimeCheck/index.js +3 -3
  39. package/dist/Time/LibJsTimeAgo/index.js +7 -8
  40. package/dist/Time/LibJsTimeGreeting/index.js +3 -4
  41. package/dist/index.js +2 -1
  42. package/dist/libJs.d.ts +1 -1
  43. package/dist/libJs.js +48 -48
  44. package/package.json +3 -3
package/dist/libJs.js CHANGED
@@ -38,73 +38,73 @@ import { libJsTimeAgo } from "./Time/LibJsTimeAgo";
38
38
  import { libJsTimeGreeting } from "./Time/LibJsTimeGreeting";
39
39
  import { libNumerStepper } from "./Misc/LibNumerStepper";
40
40
  /** @description 基础方法 */
41
- export var Base = {
41
+ export const Base = {
42
42
  /**
43
43
  * @description 返回数据类型
44
44
  * @param v 需要判断类型的数据
45
45
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsColorConsole-有色打印
46
46
  */
47
- libJsGetDataType: libJsGetDataType,
47
+ libJsGetDataType,
48
48
  /**
49
49
  * @description 延时执行,切换到其他页面会暂停
50
50
  * @param delay 延时毫秒数
51
51
  * @param fn 延时执行函数
52
52
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsPromiseTimeout-延时执行
53
53
  */
54
- libJsPromiseTimeout: libJsPromiseTimeout,
54
+ libJsPromiseTimeout,
55
55
  };
56
56
  /** @description 浏览器相关方法 */
57
- export var Browser = {
57
+ export const Browser = {
58
58
  /** @description console颜色打印
59
59
  * @param title 标题
60
60
  * @param color 颜色
61
61
  * @param logs 信息
62
62
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsColorConsole-有色打印
63
63
  */
64
- libJsColorConsole: libJsColorConsole,
64
+ libJsColorConsole,
65
65
  /** @description 判断是否为移动设备
66
66
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsIsMobile-判断手机
67
67
  */
68
- libJsIsMobile: libJsIsMobile,
68
+ libJsIsMobile,
69
69
  /** @description 判断是否为平板
70
70
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsIsPad-判断平板
71
71
  */
72
- libJsIsPad: libJsIsPad,
72
+ libJsIsPad,
73
73
  /** @description 获取浏览器地址栏参数
74
74
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsPathParams-地址栏参数
75
75
  */
76
- libJsPathParams: libJsPathParams,
76
+ libJsPathParams,
77
77
  /** @description 动态设置网站标题及图标
78
78
  * @param title 网站标题
79
79
  * @param url 网站图标地址
80
80
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsSetTitleIcon-网站标题图标
81
81
  */
82
- libJsSetTitleIcon: libJsSetTitleIcon,
82
+ libJsSetTitleIcon,
83
83
  /** @description 网站标题交互,当从当前网页切换到其他网页,网站标题自动切换
84
84
  * @param backTitle 从其他网页返回时显示的标题
85
85
  * @param leaveTitle 从当前网页离开时显示的标题
86
86
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsTagTitleTip-网站标题交互
87
87
  */
88
- libJsTagTitleTip: libJsTagTitleTip,
88
+ libJsTagTitleTip,
89
89
  /** @description 对象转为url参数
90
90
  * @param params 对象参数
91
91
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsObjToUrlParams-对象转Url参数
92
92
  */
93
- libJsObjToUrlParams: libJsObjToUrlParams,
93
+ libJsObjToUrlParams,
94
94
  };
95
95
  /** @description 数据相关方法 */
96
- export var Data = {
96
+ export const Data = {
97
97
  /**
98
98
  * @description 将数组拆分成指定数组元素数量的多个数组
99
99
  * @param arr 需要拆分的数组
100
100
  * @param chunkSize 每个数组的元素数量
101
101
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsChunkArray-数组拆分
102
102
  */
103
- libJsChunkArray: libJsChunkArray,
103
+ libJsChunkArray,
104
104
  /** @description 递归将JSON字符串深度解析为对象
105
105
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsDeepJSONParse-深度解析JSON
106
106
  */
107
- libJsDeepJSONParse: libJsDeepJSONParse,
107
+ libJsDeepJSONParse,
108
108
  /**
109
109
  * @description 分类汇总,将数组对象按照指定键值整理成一个以键值为键名的对象
110
110
  * @param arr 要分组的数组
@@ -112,7 +112,7 @@ export var Data = {
112
112
  * @returns 分组后的对象
113
113
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsGroupArrayByKey-分类汇总
114
114
  */
115
- libJsGroupArrayByKey: libJsGroupArrayByKey,
115
+ libJsGroupArrayByKey,
116
116
  /**
117
117
  * @description 匹配电子邮件,可用于实时输入时,自动补全常用邮箱后缀
118
118
  * @param str 要匹配的字符串
@@ -120,121 +120,121 @@ export var Data = {
120
120
  * @returns 匹配结果数组
121
121
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsMatchEmail-匹配E-Mail
122
122
  */
123
- libJsMatchEmail: libJsMatchEmail,
123
+ libJsMatchEmail,
124
124
  /** @description 数组乱序
125
125
  * @param arr 需要乱序的数组
126
126
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsShuffleArray-数组乱序
127
127
  */
128
- libJsShuffleArray: libJsShuffleArray,
128
+ libJsShuffleArray,
129
129
  /** @description 数组元素整体步数移动
130
130
  * @param arr 移动的数组
131
131
  * @param step 负数为向后移动,正数为向前移动
132
132
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsStepArray-数组偏移
133
133
  */
134
- libJsStepArray: libJsStepArray,
134
+ libJsStepArray,
135
135
  /** @description 翻转指定索引后面的数组
136
136
  * @param arr 数组
137
137
  * @param index 开始索引
138
138
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibReverseArrayFromIndex-数组定位翻转
139
139
  */
140
- libReverseArrayFromIndex: libReverseArrayFromIndex,
140
+ libReverseArrayFromIndex,
141
141
  };
142
142
  /** @description 文件相关方法 */
143
- export var File = {
143
+ export const File = {
144
144
  /** @description 下载图片链接
145
145
  * @param link 图片链接
146
146
  * @param name 图片名称
147
147
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsDownloadImageLink-图片下载
148
148
  */
149
- libJsDownloadImageLink: libJsDownloadImageLink,
149
+ libJsDownloadImageLink,
150
150
  /** @description 图片压缩
151
151
  * @param obj 压缩参数
152
152
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsImageOptimizer-图片压缩
153
153
  */
154
- libJsImageOptimizer: libJsImageOptimizer,
154
+ libJsImageOptimizer,
155
155
  /**
156
156
  * @description 保存文件到本地
157
157
  * @param data 要保存的数据
158
158
  * @param name 文件名
159
159
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsSaveJson-保存文件
160
160
  */
161
- libJsSaveJson: libJsSaveJson,
161
+ libJsSaveJson,
162
162
  };
163
163
  /** @description 格式化相关方法 */
164
- export var Formatter = {
164
+ export const Formatter = {
165
165
  /**
166
166
  * @description 格式化字节大小
167
167
  * @param bytes 字节数
168
168
  * @returns ['大小', '单位', '大小及单位']
169
169
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsFormatterByte-字节格式化
170
170
  */
171
- libJsFormatterByte: libJsFormatterByte,
171
+ libJsFormatterByte,
172
172
  /**
173
173
  * @description 隐藏手机号码中间的四位数字
174
174
  * @param mobile 需要处理的手机号码
175
175
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsMaskPhoneNumber-隐藏手机号码
176
176
  */
177
- libJsMaskPhoneNumber: libJsMaskPhoneNumber,
177
+ libJsMaskPhoneNumber,
178
178
  /**
179
179
  * @description 数字每三位添加逗号
180
180
  * @param num 需要格式化的数字
181
181
  * @param reserve 保留小数位数
182
182
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsNumComma-数字逗号
183
183
  */
184
- libJsNumComma: libJsNumComma,
184
+ libJsNumComma,
185
185
  /** @description 将大于1000的数字使用k为单位
186
186
  * @param num 数字
187
187
  * @param units 单位组,key为单位,value为格式化阈值
188
188
  * @returns [数字, 单位]
189
189
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsNumberUnit-数字单位
190
190
  */
191
- libJsNumberUnit: libJsNumberUnit,
191
+ libJsNumberUnit,
192
192
  /**
193
193
  * @description 将秒数格式化为中文时间描述,支持扩展到年和月
194
194
  * @param seconds 秒数
195
195
  * @returns 格式化后的中文时间
196
196
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsSecondsFormatterChinese-中文时间
197
197
  */
198
- libJsSecondsFormatterChinese: libJsSecondsFormatterChinese,
198
+ libJsSecondsFormatterChinese,
199
199
  };
200
200
  /** @description 数学相关方法 */
201
- export var Math = {
201
+ export const Math = {
202
202
  /** @description 计算表达式字符串
203
203
  * @param expression 表达式字符串
204
204
  * @param point 小数点精度
205
205
  * @returns 计算结果
206
206
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsCalculateExpression-表达式字符串
207
207
  */
208
- libJsCalculateExpression: libJsCalculateExpression,
208
+ libJsCalculateExpression,
209
209
  /**
210
210
  * @description 角度和弧度互相转换
211
211
  * @param value 角度值或弧度值
212
212
  * @param type 角度类型或弧度类型
213
213
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsConvertAngle-角弧度互转
214
214
  */
215
- libJsConvertAngle: libJsConvertAngle,
215
+ libJsConvertAngle,
216
216
  /** @description 计算两点角度
217
217
  * @param coord1 起点坐标
218
218
  * @param coord2 终点坐标
219
219
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsCoordsAngle-两点角度
220
220
  */
221
- libJsCoordsAngle: libJsCoordsAngle,
221
+ libJsCoordsAngle,
222
222
  /** @description 计算两点距离
223
223
  * @param coord1 起点坐标
224
224
  * @param coord2 终点坐标
225
225
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsCoordsDistance-两点距离
226
226
  */
227
- libJsCoordsDistance: libJsCoordsDistance,
227
+ libJsCoordsDistance,
228
228
  /** @description 计算两个数的运算结果,并保留指定位数的小数
229
229
  * @param num1 第一个数
230
230
  * @param num2 第二个数
231
231
  * @param operator 运算符,支持加减乘除
232
232
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsDecimal-高精度计算
233
233
  */
234
- libJsDecimal: libJsDecimal,
234
+ libJsDecimal,
235
235
  };
236
236
  /** @description 杂项相关方法 */
237
- export var Misc = {
237
+ export const Misc = {
238
238
  /**
239
239
  * @description 表单验证函数
240
240
  * @param form 表单数据对象
@@ -242,7 +242,7 @@ export var Misc = {
242
242
  * @returns 验证结果数组,包含未通过验证的项
243
243
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsRegFormValidate-表单验证
244
244
  */
245
- libJsRegFormValidate: libJsRegFormValidate,
245
+ libJsRegFormValidate,
246
246
  /** @description 请求失败重连
247
247
  * @param promiseFn 请求函数
248
248
  * @param maxRetries 最大重试次数
@@ -250,41 +250,41 @@ export var Misc = {
250
250
  * @param params 请求参数
251
251
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsRetryRequest-请求重连
252
252
  */
253
- libJsRetryRequest: libJsRetryRequest,
253
+ libJsRetryRequest,
254
254
  /** @description 数字步进器
255
255
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibNumerStepper-数字步进器
256
256
  */
257
- libNumerStepper: libNumerStepper,
257
+ libNumerStepper,
258
258
  };
259
259
  /** @description 随机相关方法 */
260
- export var Random = {
260
+ export const Random = {
261
261
  /** @description 百分比概率结果
262
262
  * @param probability 触发概率,百分比,0-100
263
263
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsProbabilityResult-概率触发
264
264
  */
265
- libJsProbabilityResult: libJsProbabilityResult,
265
+ libJsProbabilityResult,
266
266
  /** @description 随机数
267
267
  * @param min 最小值
268
268
  * @param max 最大值
269
269
  * @param num 保留小数位数
270
270
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsRandom-随机数
271
271
  */
272
- libJsRandom: libJsRandom,
272
+ libJsRandom,
273
273
  /** @description 随机 RGBA 颜色
274
274
  * @param alpha 透明度
275
275
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsRandomColor-随机色
276
276
  */
277
- libJsRandomColor: libJsRandomColor,
277
+ libJsRandomColor,
278
278
  /** @description 随机生成n个指定范围的随机数数组
279
279
  * @param min 最小值
280
280
  * @param max 最大值
281
281
  * @param count 数组长度
282
282
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsUniqueRandomNumbers-随机数数组
283
283
  */
284
- libJsUniqueRandomNumbers: libJsUniqueRandomNumbers,
284
+ libJsUniqueRandomNumbers,
285
285
  };
286
286
  /** @description 时间相关方法 */
287
- export var Time = {
287
+ export const Time = {
288
288
  /**
289
289
  * @description 传入时间戳与当前时间判断是否为同一天或同一周
290
290
  * @param timestamp 毫秒时间戳
@@ -292,16 +292,16 @@ export var Time = {
292
292
  * @returns 0-同一单位时间 1-新单位时间 -1时间戳大于当前时间
293
293
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsSameTimeCheck-时间比对
294
294
  */
295
- libJsSameTimeCheck: libJsSameTimeCheck,
295
+ libJsSameTimeCheck,
296
296
  /** @description 时间差计算
297
297
  * @param timestamp 毫秒时间戳
298
298
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsTimeAgo-中文时间差
299
299
  */
300
- libJsTimeAgo: libJsTimeAgo,
300
+ libJsTimeAgo,
301
301
  /**
302
302
  * @description 根据当前时间返回问候语
303
303
  * @param greet 自定义问候语对象
304
304
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsTimeGreeting-时间问候
305
305
  */
306
- libJsTimeGreeting: libJsTimeGreeting,
306
+ libJsTimeGreeting,
307
307
  };
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "lyb-js",
3
- "version": "1.1.11",
3
+ "version": "1.2.1",
4
4
  "description": "自用JS方法库",
5
5
  "license": "ISC",
6
6
  "type": "module",
7
7
  "types": "./dist/index.d.ts",
8
8
  "main": "./dist/index.js",
9
9
  "scripts": {
10
- "build": "tsc & vite build"
10
+ "build": "vite build & tsc"
11
11
  },
12
12
  "exports": {
13
13
  "./*": "./dist/*"
@@ -41,4 +41,4 @@
41
41
  "decimal.js": "^10.4.3",
42
42
  "vite": "^4.5.5"
43
43
  }
44
- }
44
+ }