lyb-js 1.1.1 → 1.1.4

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 +12 -0
  2. package/dist/Base/LibJsGetDataType/index.d.ts +1 -0
  3. package/dist/Base/LibJsGetDataType/index.js +1 -0
  4. package/dist/Base/LibJsPromiseTimeout/index.d.ts +1 -0
  5. package/dist/Base/LibJsPromiseTimeout/index.js +1 -0
  6. package/dist/Browser/LibJsColorConsole/index.d.ts +1 -0
  7. package/dist/Browser/LibJsColorConsole/index.js +1 -0
  8. package/dist/Browser/LibJsIsMobile/index.d.ts +1 -0
  9. package/dist/Browser/LibJsIsMobile/index.js +1 -0
  10. package/dist/Browser/LibJsIsPad/index.d.ts +1 -0
  11. package/dist/Browser/LibJsIsPad/index.js +1 -0
  12. package/dist/Browser/LibJsObjToUrlParams/index.d.ts +1 -0
  13. package/dist/Browser/LibJsObjToUrlParams/index.js +1 -0
  14. package/dist/Browser/LibJsPathParams/index.d.ts +1 -0
  15. package/dist/Browser/LibJsPathParams/index.js +1 -0
  16. package/dist/Browser/LibJsSetTitleIcon/index.d.ts +1 -0
  17. package/dist/Browser/LibJsSetTitleIcon/index.js +1 -0
  18. package/dist/Browser/LibJsTagTitleTip/index.d.ts +1 -0
  19. package/dist/Browser/LibJsTagTitleTip/index.js +1 -0
  20. package/dist/Data/LibJsChunkArray/index.d.ts +1 -0
  21. package/dist/Data/LibJsChunkArray/index.js +1 -0
  22. package/dist/Data/LibJsDeepJSONParse/index.d.ts +1 -0
  23. package/dist/Data/LibJsDeepJSONParse/index.js +1 -0
  24. package/dist/Data/LibJsGroupArrayByKey/index.d.ts +1 -0
  25. package/dist/Data/LibJsGroupArrayByKey/index.js +1 -0
  26. package/dist/Data/LibJsMatchEmail/index.d.ts +1 -0
  27. package/dist/Data/LibJsMatchEmail/index.js +1 -0
  28. package/dist/Data/LibJsShuffleArray/index.d.ts +1 -0
  29. package/dist/Data/LibJsShuffleArray/index.js +1 -0
  30. package/dist/Data/LibJsStepArray/index.d.ts +2 -1
  31. package/dist/Data/LibJsStepArray/index.js +2 -1
  32. package/dist/Data/LibReverseArrayFromIndex/index.d.ts +1 -0
  33. package/dist/Data/LibReverseArrayFromIndex/index.js +1 -0
  34. package/dist/File/LibJsDownloadImageLink/index.d.ts +1 -0
  35. package/dist/File/LibJsDownloadImageLink/index.js +1 -0
  36. package/dist/File/LibJsImageOptimizer/index.d.ts +1 -0
  37. package/dist/File/LibJsImageOptimizer/index.js +1 -0
  38. package/dist/File/LibJsSaveJson/index.d.ts +1 -0
  39. package/dist/File/LibJsSaveJson/index.js +1 -0
  40. package/dist/Formatter/LibJsFormatterByte/index.d.ts +1 -0
  41. package/dist/Formatter/LibJsFormatterByte/index.js +1 -0
  42. package/dist/Formatter/LibJsMaskPhoneNumber/index.d.ts +2 -1
  43. package/dist/Formatter/LibJsMaskPhoneNumber/index.js +2 -1
  44. package/dist/Formatter/LibJsNumComma/index.d.ts +1 -0
  45. package/dist/Formatter/LibJsNumComma/index.js +1 -0
  46. package/dist/Formatter/LibJsNumberUnit/index.d.ts +1 -0
  47. package/dist/Formatter/LibJsNumberUnit/index.js +1 -0
  48. package/dist/Formatter/LibJsSecondsFormatterChinese/index.d.ts +1 -0
  49. package/dist/Formatter/LibJsSecondsFormatterChinese/index.js +1 -0
  50. package/dist/Math/LibJsCalculateExpression/index.d.ts +1 -0
  51. package/dist/Math/LibJsCalculateExpression/index.js +1 -0
  52. package/dist/Math/LibJsConvertAngle/index.d.ts +1 -0
  53. package/dist/Math/LibJsConvertAngle/index.js +1 -0
  54. package/dist/Math/LibJsCoordsAngle/index.d.ts +1 -0
  55. package/dist/Math/LibJsCoordsAngle/index.js +1 -0
  56. package/dist/Math/LibJsCoordsDistance/index.d.ts +1 -0
  57. package/dist/Math/LibJsCoordsDistance/index.js +1 -0
  58. package/dist/Math/LibJsDecimal/index.d.ts +1 -0
  59. package/dist/Math/LibJsDecimal/index.js +1 -0
  60. package/dist/Misc/LibJsRegFormValidate/index.d.ts +1 -0
  61. package/dist/Misc/LibJsRegFormValidate/index.js +1 -0
  62. package/dist/Misc/LibJsRetryRequest/index.d.ts +1 -0
  63. package/dist/Misc/LibJsRetryRequest/index.js +1 -0
  64. package/dist/Misc/LibNumerStepper/index.d.ts +1 -0
  65. package/dist/Misc/LibNumerStepper/index.js +1 -0
  66. package/dist/Random/LibJsProbabilityResult/index.d.ts +1 -0
  67. package/dist/Random/LibJsProbabilityResult/index.js +1 -0
  68. package/dist/Random/LibJsRandom/index.d.ts +2 -1
  69. package/dist/Random/LibJsRandom/index.js +2 -1
  70. package/dist/Random/LibJsRandomColor/index.d.ts +1 -0
  71. package/dist/Random/LibJsRandomColor/index.js +1 -0
  72. package/dist/Random/LibJsUniqueRandomNumbers/index.d.ts +1 -0
  73. package/dist/Random/LibJsUniqueRandomNumbers/index.js +1 -0
  74. package/dist/Time/LibJsSameTimeCheck/index.d.ts +1 -0
  75. package/dist/Time/LibJsSameTimeCheck/index.js +1 -0
  76. package/dist/Time/LibJsTimeAgo/index.d.ts +1 -0
  77. package/dist/Time/LibJsTimeAgo/index.js +1 -0
  78. package/dist/Time/LibJsTimeGreeting/index.d.ts +1 -0
  79. package/dist/Time/LibJsTimeGreeting/index.js +1 -0
  80. package/dist/libJs.d.ts +39 -1
  81. package/dist/libJs.js +39 -1
  82. package/package.json +12 -5
  83. package/umd/lyb.js +8 -0
package/README.md CHANGED
@@ -38,6 +38,18 @@ libJsGetDataType("Hellow World!"); //"string"
38
38
  libJsCalculateExpression("(1+2)-(3*4)/5"); //0.6
39
39
  ```
40
40
 
41
+ **通过 `CDN ` 使用 `LibJs`**
42
+
43
+ > 你可以借助 `script` 标签直接通过 `CDN` 来使用 `LibJs`
44
+
45
+ ```html
46
+ <script src="https://unpkg.com/lyb-js/umd/lyb.js"></script>
47
+
48
+ <script>
49
+ LibJs.Base.libJsGetDataType("Hellow World!"); //"string"
50
+ </script>
51
+ ```
52
+
41
53
  ## 目录
42
54
 
43
55
  ### 基础
@@ -2,6 +2,7 @@ export type LibJsGetDataTypeReturnType = "string" | "number" | "boolean" | "arra
2
2
  /**
3
3
  * @description 返回数据类型
4
4
  * @param v 需要判断类型的数据
5
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
5
6
  * @example
6
7
  * libJsGetDataType(123); //"number"
7
8
  * libJsGetDataType("hello"); //"string"
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * @description 返回数据类型
3
3
  * @param v 需要判断类型的数据
4
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
4
5
  * @example
5
6
  * libJsGetDataType(123); //"number"
6
7
  * libJsGetDataType("hello"); //"string"
@@ -2,6 +2,7 @@
2
2
  * @description 延时执行,切换到其他页面会暂停
3
3
  * @param delay 延时毫秒数
4
4
  * @param fn 延时执行函数
5
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
5
6
  * @example
6
7
  * libJsPromiseTimeout(3000, () => {
7
8
  * console.log("执行延时函数");
@@ -2,6 +2,7 @@
2
2
  * @description 延时执行,切换到其他页面会暂停
3
3
  * @param delay 延时毫秒数
4
4
  * @param fn 延时执行函数
5
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
5
6
  * @example
6
7
  * libJsPromiseTimeout(3000, () => {
7
8
  * console.log("执行延时函数");
@@ -2,6 +2,7 @@
2
2
  * @param title 标题
3
3
  * @param color 颜色
4
4
  * @param logs 信息
5
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
5
6
  * @example
6
7
  * //使用红色打印日志
7
8
  * libJsColorConsole("错误提示", "red", [{ label: "错误代码", value: 500 }]);
@@ -2,6 +2,7 @@
2
2
  * @param title 标题
3
3
  * @param color 颜色
4
4
  * @param logs 信息
5
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
5
6
  * @example
6
7
  * //使用红色打印日志
7
8
  * libJsColorConsole("错误提示", "red", [{ label: "错误代码", value: 500 }]);
@@ -1,4 +1,5 @@
1
1
  /** @description 判断是否为移动设备
2
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
2
3
  * @example
3
4
  * const isMobile = libIsMobile();
4
5
  * console.log(isMobile); //true 或 false
@@ -1,4 +1,5 @@
1
1
  /** @description 判断是否为移动设备
2
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
2
3
  * @example
3
4
  * const isMobile = libIsMobile();
4
5
  * console.log(isMobile); //true 或 false
@@ -1,4 +1,5 @@
1
1
  /** @description 判断是否为平板
2
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
2
3
  * @example
3
4
  * const isPad = libJsIsPad();
4
5
  * console.log(isPad); //true 或 false
@@ -1,4 +1,5 @@
1
1
  /** @description 判断是否为平板
2
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
2
3
  * @example
3
4
  * const isPad = libJsIsPad();
4
5
  * console.log(isPad); //true 或 false
@@ -1,5 +1,6 @@
1
1
  /** @description 将对象转为地址栏参数
2
2
  * @param params 对象参数
3
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
3
4
  * @example
4
5
  * libJsObjToUrlParams({ name: "John", age: 30, active: true });
5
6
  * // "name=John&age=30&active=true"
@@ -1,5 +1,6 @@
1
1
  /** @description 将对象转为地址栏参数
2
2
  * @param params 对象参数
3
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
3
4
  * @example
4
5
  * libJsObjToUrlParams({ name: "John", age: 30, active: true });
5
6
  * // "name=John&age=30&active=true"
@@ -1,4 +1,5 @@
1
1
  /** @description 获取浏览器地址栏参数
2
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
2
3
  * @example
3
4
  * const params = libJsPathParams();
4
5
  * console.log(params); //{ param1: "value1", param2: "value2" }
@@ -1,4 +1,5 @@
1
1
  /** @description 获取浏览器地址栏参数
2
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
2
3
  * @example
3
4
  * const params = libJsPathParams();
4
5
  * console.log(params); //{ param1: "value1", param2: "value2" }
@@ -1,6 +1,7 @@
1
1
  /** @description 动态设置网站标题及图标
2
2
  * @param title 网站标题
3
3
  * @param url 网站图标地址
4
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
4
5
  * @example
5
6
  * libJsSetTitleIcon("我的网站", "https://example.com/favicon.ico");
6
7
  */
@@ -1,6 +1,7 @@
1
1
  /** @description 动态设置网站标题及图标
2
2
  * @param title 网站标题
3
3
  * @param url 网站图标地址
4
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
4
5
  * @example
5
6
  * libJsSetTitleIcon("我的网站", "https://example.com/favicon.ico");
6
7
  */
@@ -1,6 +1,7 @@
1
1
  /** @description 网站标题交互,当从当前网页切换到其他网页,网站标题自动切换
2
2
  * @param backTitle 从其他网页返回时显示的标题
3
3
  * @param leaveTitle 从当前网页离开时显示的标题
4
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
4
5
  * @example
5
6
  * libJsTagTitleTip("欢迎回来", "来和妲己玩耍吧!");
6
7
  */
@@ -1,6 +1,7 @@
1
1
  /** @description 网站标题交互,当从当前网页切换到其他网页,网站标题自动切换
2
2
  * @param backTitle 从其他网页返回时显示的标题
3
3
  * @param leaveTitle 从当前网页离开时显示的标题
4
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
4
5
  * @example
5
6
  * libJsTagTitleTip("欢迎回来", "来和妲己玩耍吧!");
6
7
  */
@@ -2,6 +2,7 @@
2
2
  * @description 将数组拆分成指定数组元素数量的多个数组
3
3
  * @param arr 需要拆分的数组
4
4
  * @param chunkSize 每个数组的元素数量
5
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
5
6
  * @example
6
7
  * const chunks = libJsChunkArray([1, 2, 3, 4, 5, 6], 2);
7
8
  * console.log(chunks); //[[1, 2], [3, 4], [5, 6]]
@@ -2,6 +2,7 @@
2
2
  * @description 将数组拆分成指定数组元素数量的多个数组
3
3
  * @param arr 需要拆分的数组
4
4
  * @param chunkSize 每个数组的元素数量
5
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
5
6
  * @example
6
7
  * const chunks = libJsChunkArray([1, 2, 3, 4, 5, 6], 2);
7
8
  * console.log(chunks); //[[1, 2], [3, 4], [5, 6]]
@@ -1,4 +1,5 @@
1
1
  /** @description 递归将JSON字符串深度解析为对象
2
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
2
3
  * @example
3
4
  * const obj = libJsDeepJSONParse('{"a": 1, "b": "{\"c\": 2}"}');
4
5
  * console.log(obj); //{ a: 1, b: { c: 2 } }
@@ -1,4 +1,5 @@
1
1
  /** @description 递归将JSON字符串深度解析为对象
2
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
2
3
  * @example
3
4
  * const obj = libJsDeepJSONParse('{"a": 1, "b": "{\"c\": 2}"}');
4
5
  * console.log(obj); //{ a: 1, b: { c: 2 } }
@@ -3,6 +3,7 @@
3
3
  * @param arr 要分组的数组
4
4
  * @param key 分组的键
5
5
  * @returns 分组后的对象
6
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
6
7
  * @example
7
8
  * const grouped = libJsGroupArrayByKey([{ id: 1, name: 'A' }, { id: 2, name: 'B' }, { id: 1, name: 'C' }], 'id');
8
9
  * console.log(grouped); //{ 1: [{ id: 1, name: 'A' }, { id: 1, name: 'C' }], 2: [{ id: 2, name: 'B' }] }
@@ -3,6 +3,7 @@
3
3
  * @param arr 要分组的数组
4
4
  * @param key 分组的键
5
5
  * @returns 分组后的对象
6
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
6
7
  * @example
7
8
  * const grouped = libJsGroupArrayByKey([{ id: 1, name: 'A' }, { id: 2, name: 'B' }, { id: 1, name: 'C' }], 'id');
8
9
  * console.log(grouped); //{ 1: [{ id: 1, name: 'A' }, { id: 1, name: 'C' }], 2: [{ id: 2, name: 'B' }] }
@@ -3,6 +3,7 @@
3
3
  * @param str 要匹配的字符串
4
4
  * @param emailList 电子邮件后缀列表
5
5
  * @returns 匹配结果数组
6
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
6
7
  * @example
7
8
  * const emails = libJsMatchEmail("user", ["@gmail.com", "@yahoo.com"]);
8
9
  * console.log(emails); //["user@gmail.com", "user@yahoo.com"]
@@ -3,6 +3,7 @@
3
3
  * @param str 要匹配的字符串
4
4
  * @param emailList 电子邮件后缀列表
5
5
  * @returns 匹配结果数组
6
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
6
7
  * @example
7
8
  * const emails = libJsMatchEmail("user", ["@gmail.com", "@yahoo.com"]);
8
9
  * console.log(emails); //["user@gmail.com", "user@yahoo.com"]
@@ -1,5 +1,6 @@
1
1
  /** @description 将数组打乱顺序
2
2
  * @param arr 需要乱序的数组
3
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
3
4
  * @example
4
5
  * const shuffled = libJsShuffleArray([1, 2, 3, 4, 5]);
5
6
  * console.log(shuffled); //[3, 5, 2, 1, 4] (结果每次不同)
@@ -1,5 +1,6 @@
1
1
  /** @description 将数组打乱顺序
2
2
  * @param arr 需要乱序的数组
3
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
3
4
  * @example
4
5
  * const shuffled = libJsShuffleArray([1, 2, 3, 4, 5]);
5
6
  * console.log(shuffled); //[3, 5, 2, 1, 4] (结果每次不同)
@@ -1,7 +1,8 @@
1
1
  /** @description 数组元素整体步数移动
2
2
  * @param arr 移动的数组
3
3
  * @param step 负数为向后移动,正数为向前移动
4
- * @example
4
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
5
+ * @example
5
6
  * const moved = libJsStepArray([1, 2, 3, 4, 5], 2);
6
7
  * console.log(moved); //[4, 5, 1, 2, 3]
7
8
  */
@@ -1,7 +1,8 @@
1
1
  /** @description 数组元素整体步数移动
2
2
  * @param arr 移动的数组
3
3
  * @param step 负数为向后移动,正数为向前移动
4
- * @example
4
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
5
+ * @example
5
6
  * const moved = libJsStepArray([1, 2, 3, 4, 5], 2);
6
7
  * console.log(moved); //[4, 5, 1, 2, 3]
7
8
  */
@@ -1,6 +1,7 @@
1
1
  /** @description 翻转指定索引后面的数组
2
2
  * @param arr 数组
3
3
  * @param index 开始索引
4
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
4
5
  * @example
5
6
  * libReverseArrayFromIndex([1, 2, 3, 4, 5], 1);
6
7
  * // [1, 2, 5, 4, 3]
@@ -1,6 +1,7 @@
1
1
  /** @description 翻转指定索引后面的数组
2
2
  * @param arr 数组
3
3
  * @param index 开始索引
4
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
4
5
  * @example
5
6
  * libReverseArrayFromIndex([1, 2, 3, 4, 5], 1);
6
7
  * // [1, 2, 5, 4, 3]
@@ -1,6 +1,7 @@
1
1
  /** @description 将链接图片下载到本地
2
2
  * @param link 图片链接
3
3
  * @param name 图片名称
4
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
4
5
  * @example
5
6
  * libJsDownloadImageLink("https://example.com/image.jpg", "图片.jpg");
6
7
  */
@@ -1,6 +1,7 @@
1
1
  /** @description 将链接图片下载到本地
2
2
  * @param link 图片链接
3
3
  * @param name 图片名称
4
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
4
5
  * @example
5
6
  * libJsDownloadImageLink("https://example.com/image.jpg", "图片.jpg");
6
7
  */
@@ -14,6 +14,7 @@ export type LibJsImageOptimizerOptionsParams = {
14
14
  };
15
15
  /** @description 图片压缩,支持png压缩,保留透明背景
16
16
  * @param obj 压缩参数
17
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
17
18
  * @example
18
19
  * libJsImageOptimizerOptionsParams({
19
20
  * file: myFile,
@@ -1,5 +1,6 @@
1
1
  /** @description 图片压缩,支持png压缩,保留透明背景
2
2
  * @param obj 压缩参数
3
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
3
4
  * @example
4
5
  * libJsImageOptimizerOptionsParams({
5
6
  * file: myFile,
@@ -2,6 +2,7 @@
2
2
  * @description 保存文件到本地
3
3
  * @param name 文件名
4
4
  * @param data 要保存的数据
5
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
5
6
  * @example
6
7
  * libJsSaveJson("example.json", JSON.stringify({ key: "value" }));
7
8
  * libJsSaveJson("example.txt", "Hellow World!");
@@ -2,6 +2,7 @@
2
2
  * @description 保存文件到本地
3
3
  * @param name 文件名
4
4
  * @param data 要保存的数据
5
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
5
6
  * @example
6
7
  * libJsSaveJson("example.json", JSON.stringify({ key: "value" }));
7
8
  * libJsSaveJson("example.txt", "Hellow World!");
@@ -2,6 +2,7 @@
2
2
  * @description 格式化字节大小
3
3
  * @param bytes 字节数
4
4
  * @returns ['大小', '单位', '大小及单位']
5
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
5
6
  * @example
6
7
  * const [size, unit, formatted] = libJsFormatterByte(2048);
7
8
  * console.log(size, unit, formatted); //2.00 KB 2.00 KB
@@ -2,6 +2,7 @@
2
2
  * @description 格式化字节大小
3
3
  * @param bytes 字节数
4
4
  * @returns ['大小', '单位', '大小及单位']
5
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
5
6
  * @example
6
7
  * const [size, unit, formatted] = libJsFormatterByte(2048);
7
8
  * console.log(size, unit, formatted); //2.00 KB 2.00 KB
@@ -1,7 +1,8 @@
1
1
  /**
2
2
  * @description 隐藏手机号码中间的四位数字
3
3
  * @param mobile 需要处理的手机号码
4
- * @example
4
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
5
+ * @example
5
6
  * const masked = libJsMaskPhoneNumber("13812345678");
6
7
  * console.log(masked); //138****5678
7
8
  */
@@ -1,7 +1,8 @@
1
1
  /**
2
2
  * @description 隐藏手机号码中间的四位数字
3
3
  * @param mobile 需要处理的手机号码
4
- * @example
4
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
5
+ * @example
5
6
  * const masked = libJsMaskPhoneNumber("13812345678");
6
7
  * console.log(masked); //138****5678
7
8
  */
@@ -2,6 +2,7 @@
2
2
  * @description 数字每三位添加逗号
3
3
  * @param num 需要格式化的数字
4
4
  * @param reserve 保留小数位数
5
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
5
6
  * @example
6
7
  * const formatted = libJsNumComma(1234567.89);
7
8
  * console.log(formatted); //1,234,567.89
@@ -2,6 +2,7 @@
2
2
  * @description 数字每三位添加逗号
3
3
  * @param num 需要格式化的数字
4
4
  * @param reserve 保留小数位数
5
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
5
6
  * @example
6
7
  * const formatted = libJsNumComma(1234567.89);
7
8
  * console.log(formatted); //1,234,567.89
@@ -5,6 +5,7 @@ export interface LibJsNumberUnitParams {
5
5
  * @param num 数字
6
6
  * @param units 单位组,key为单位,value为格式化阈值
7
7
  * @returns [数字, 单位]
8
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
8
9
  * @example
9
10
  * const [value, unit] = libJsNumberUnit(1500, { K: 1000, M: 1000000 });
10
11
  * console.log(value, unit); //1.50 K
@@ -3,6 +3,7 @@ import Decimal from "decimal.js";
3
3
  * @param num 数字
4
4
  * @param units 单位组,key为单位,value为格式化阈值
5
5
  * @returns [数字, 单位]
6
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
6
7
  * @example
7
8
  * const [value, unit] = libJsNumberUnit(1500, { K: 1000, M: 1000000 });
8
9
  * console.log(value, unit); //1.50 K
@@ -2,6 +2,7 @@
2
2
  * @description 将秒数格式化为中文时间描述,支持扩展到年
3
3
  * @param seconds 秒数
4
4
  * @returns 格式化后的中文时间
5
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
5
6
  * @example
6
7
  * libJsSecondsFormatterChinese(100000); //"1天3小时46分40秒"
7
8
  * libJsSecondsFormatterChinese(31536000); //"1年"
@@ -5,6 +5,7 @@ dayjs.extend(duration);
5
5
  * @description 将秒数格式化为中文时间描述,支持扩展到年
6
6
  * @param seconds 秒数
7
7
  * @returns 格式化后的中文时间
8
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
8
9
  * @example
9
10
  * libJsSecondsFormatterChinese(100000); //"1天3小时46分40秒"
10
11
  * libJsSecondsFormatterChinese(31536000); //"1年"
@@ -2,6 +2,7 @@
2
2
  * @param expression 表达式字符串
3
3
  * @param point 小数点精度
4
4
  * @returns 计算结果
5
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
5
6
  * @example
6
7
  * const result = libJsCalculateExpression("(1+2)-(3*4)/5");
7
8
  * console.log(result); //0.6
@@ -3,6 +3,7 @@ import Decimal from 'decimal.js';
3
3
  * @param expression 表达式字符串
4
4
  * @param point 小数点精度
5
5
  * @returns 计算结果
6
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
6
7
  * @example
7
8
  * const result = libJsCalculateExpression("(1+2)-(3*4)/5");
8
9
  * console.log(result); //0.6
@@ -2,6 +2,7 @@
2
2
  * @description 角度和弧度互相转换
3
3
  * @param value 角度值或弧度值
4
4
  * @param type 角度类型或弧度类型
5
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
5
6
  * @example
6
7
  * //角度转弧度
7
8
  * libJsConvertAngle(90, "rad"); //返回 1.5708... (π/2)
@@ -2,6 +2,7 @@
2
2
  * @description 角度和弧度互相转换
3
3
  * @param value 角度值或弧度值
4
4
  * @param type 角度类型或弧度类型
5
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
5
6
  * @example
6
7
  * //角度转弧度
7
8
  * libJsConvertAngle(90, "rad"); //返回 1.5708... (π/2)
@@ -1,6 +1,7 @@
1
1
  /** @description 计算两点角度
2
2
  * @param coord1 起点坐标
3
3
  * @param coord2 终点坐标
4
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
4
5
  * @example
5
6
  * libJsCoordsAngle({ x: 0, y: 0 }, { x: 1, y: 0 }); //0
6
7
  * libJsCoordsAngle({ x: 0, y: 0 }, { x: 1, y: 1 }); //45
@@ -1,6 +1,7 @@
1
1
  /** @description 计算两点角度
2
2
  * @param coord1 起点坐标
3
3
  * @param coord2 终点坐标
4
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
4
5
  * @example
5
6
  * libJsCoordsAngle({ x: 0, y: 0 }, { x: 1, y: 0 }); //0
6
7
  * libJsCoordsAngle({ x: 0, y: 0 }, { x: 1, y: 1 }); //45
@@ -1,6 +1,7 @@
1
1
  /** @description 计算两点距离
2
2
  * @param coord1 起点坐标
3
3
  * @param coord2 终点坐标
4
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
4
5
  * @example
5
6
  * libJsCoordsDistance({ x: 0, y: 0 }, { x: 3, y: 4 }); //5
6
7
  * libJsCoordsDistance({ x: 1, y: 1 }, { x: 4, y: 5 }); //5
@@ -1,6 +1,7 @@
1
1
  /** @description 计算两点距离
2
2
  * @param coord1 起点坐标
3
3
  * @param coord2 终点坐标
4
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
4
5
  * @example
5
6
  * libJsCoordsDistance({ x: 0, y: 0 }, { x: 3, y: 4 }); //5
6
7
  * libJsCoordsDistance({ x: 1, y: 1 }, { x: 4, y: 5 }); //5
@@ -2,6 +2,7 @@
2
2
  * @param num1 第一个数
3
3
  * @param num2 第二个数
4
4
  * @param operator 运算符,支持加减乘除
5
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
5
6
  * @example
6
7
  * libJsDecimal(10, 3, "+"); //13
7
8
  * libJsDecimal(10, 3, "-"); //7
@@ -3,6 +3,7 @@ import { Decimal } from "decimal.js";
3
3
  * @param num1 第一个数
4
4
  * @param num2 第二个数
5
5
  * @param operator 运算符,支持加减乘除
6
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
6
7
  * @example
7
8
  * libJsDecimal(10, 3, "+"); //13
8
9
  * libJsDecimal(10, 3, "-"); //7
@@ -8,6 +8,7 @@ export type ValidationResult = {
8
8
  * @param form 表单数据对象
9
9
  * @param rules 验证规则数组
10
10
  * @returns 验证结果数组,包含未通过验证的项
11
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
11
12
  * @example
12
13
  * const form = { username: "john", email: "john@example.com" };
13
14
  * const rules = [
@@ -3,6 +3,7 @@
3
3
  * @param form 表单数据对象
4
4
  * @param rules 验证规则数组
5
5
  * @returns 验证结果数组,包含未通过验证的项
6
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
6
7
  * @example
7
8
  * const form = { username: "john", email: "john@example.com" };
8
9
  * const rules = [
@@ -3,6 +3,7 @@
3
3
  * @param maxRetries 最大重试次数
4
4
  * @param retryDelay 重试间隔时间
5
5
  * @param params 请求参数
6
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
6
7
  * @example
7
8
  * const requestFn = (params: { url: string }) => fetch(params.url).then(res => res.json());
8
9
  * const params = { url: "https://api.example.com/data" };
@@ -3,6 +3,7 @@
3
3
  * @param maxRetries 最大重试次数
4
4
  * @param retryDelay 重试间隔时间
5
5
  * @param params 请求参数
6
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
6
7
  * @example
7
8
  * const requestFn = (params: { url: string }) => fetch(params.url).then(res => res.json());
8
9
  * const params = { url: "https://api.example.com/data" };
@@ -1,4 +1,5 @@
1
1
  /** @description 数字步进器
2
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
2
3
  * @example
3
4
  * const stepper = new libNumerStepper(10, (index) => console.log(index));
4
5
  * stepper.down("add"); // 索引加1
@@ -1,4 +1,5 @@
1
1
  /** @description 数字步进器
2
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
2
3
  * @example
3
4
  * const stepper = new libNumerStepper(10, (index) => console.log(index));
4
5
  * stepper.down("add"); // 索引加1
@@ -1,5 +1,6 @@
1
1
  /** @description 百分比概率结果
2
2
  * @param probability 触发概率,百分比,0-100
3
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
3
4
  * @example
4
5
  * libJsProbabilityResult(50); //50% 概率为 true
5
6
  * libJsProbabilityResult(80); //80% 概率为 true
@@ -1,5 +1,6 @@
1
1
  /** @description 百分比概率结果
2
2
  * @param probability 触发概率,百分比,0-100
3
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
3
4
  * @example
4
5
  * libJsProbabilityResult(50); //50% 概率为 true
5
6
  * libJsProbabilityResult(80); //80% 概率为 true
@@ -2,7 +2,8 @@
2
2
  * @param min 最小值
3
3
  * @param max 最大值
4
4
  * @param num 保留小数位数
5
- * @example
5
+ * @link 了解更多:https://www.npmjs.com/package/lyb-js
6
+ * @example
6
7
  * libJsRandom(1, 10); //1 到 10 之间的随机整数
7
8
  * libJsRandom(1, 10, 2); //1 到 10 之间保留两位小数的随机数
8
9
  */