lyb-js 1.1.6 → 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 (45) hide show
  1. package/README.md +3 -2
  2. package/dist/Base/LibJsGetDataType/index.js +1 -1
  3. package/dist/Base/LibJsPromiseTimeout/index.js +11 -10
  4. package/dist/Browser/LibJsColorConsole/index.js +22 -12
  5. package/dist/Browser/LibJsIsMobile/index.js +2 -2
  6. package/dist/Browser/LibJsIsPad/index.js +8 -8
  7. package/dist/Browser/LibJsObjToUrlParams/index.js +5 -2
  8. package/dist/Browser/LibJsPathParams/index.js +5 -5
  9. package/dist/Browser/LibJsSetTitleIcon/index.js +3 -3
  10. package/dist/Browser/LibJsTagTitleTip/index.js +5 -5
  11. package/dist/Data/LibJsChunkArray/index.js +3 -3
  12. package/dist/Data/LibJsDeepJSONParse/index.js +5 -5
  13. package/dist/Data/LibJsGroupArrayByKey/index.js +3 -2
  14. package/dist/Data/LibJsMatchEmail/index.js +4 -4
  15. package/dist/Data/LibJsShuffleArray/index.js +15 -5
  16. package/dist/Data/LibJsStepArray/index.js +3 -3
  17. package/dist/Data/LibReverseArrayFromIndex/index.js +12 -3
  18. package/dist/File/LibJsDownloadImageLink/index.js +5 -5
  19. package/dist/File/LibJsImageOptimizer/index.js +36 -36
  20. package/dist/File/LibJsSaveJson/index.js +4 -4
  21. package/dist/Formatter/LibJsFormatterByte/index.js +6 -6
  22. package/dist/Formatter/LibJsMaskPhoneNumber/index.js +2 -2
  23. package/dist/Formatter/LibJsNumComma/index.js +4 -3
  24. package/dist/Formatter/LibJsNumberUnit/index.d.ts +5 -5
  25. package/dist/Formatter/LibJsNumberUnit/index.js +17 -10
  26. package/dist/Formatter/LibJsSecondsFormatterChinese/index.js +15 -15
  27. package/dist/Math/LibJsCalculateExpression/index.js +19 -17
  28. package/dist/Math/LibJsConvertAngle/index.js +1 -1
  29. package/dist/Math/LibJsCoordsAngle/index.js +5 -5
  30. package/dist/Math/LibJsCoordsDistance/index.js +4 -4
  31. package/dist/Math/LibJsDecimal/index.js +8 -7
  32. package/dist/Misc/LibJsRegFormValidate/index.js +6 -6
  33. package/dist/Misc/LibJsRetryRequest/index.js +7 -6
  34. package/dist/Misc/LibNumerStepper/index.js +27 -29
  35. package/dist/Random/LibJsProbabilityResult/index.js +3 -1
  36. package/dist/Random/LibJsRandom/index.js +2 -1
  37. package/dist/Random/LibJsRandomColor/index.js +6 -5
  38. package/dist/Random/LibJsUniqueRandomNumbers/index.js +6 -5
  39. package/dist/Time/LibJsSameTimeCheck/index.js +3 -3
  40. package/dist/Time/LibJsTimeAgo/index.js +8 -7
  41. package/dist/Time/LibJsTimeGreeting/index.js +4 -3
  42. package/dist/libJs.d.ts +3 -2
  43. package/dist/libJs.js +48 -49
  44. package/package.json +1 -1
  45. package/umd/lyb.js +3 -3
@@ -7,32 +7,32 @@ dayjs.extend(duration);
7
7
  * @returns 格式化后的中文时间
8
8
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsSecondsFormatterChinese-中文时间
9
9
  */
10
- export const libJsSecondsFormatterChinese = (seconds) => {
11
- const duration = dayjs.duration(seconds, "seconds");
12
- const years = Math.floor(duration.asYears());
13
- const months = Math.floor(duration.asMonths() % 12);
14
- const days = Math.floor(duration.asDays() % 30);
15
- const hours = duration.hours();
16
- const minutes = duration.minutes();
17
- const remainingSeconds = duration.seconds();
18
- const timeParts = [];
10
+ export var libJsSecondsFormatterChinese = function (seconds) {
11
+ var duration = dayjs.duration(seconds, "seconds");
12
+ var years = Math.floor(duration.asYears());
13
+ var months = Math.floor(duration.asMonths() % 12);
14
+ var days = Math.floor(duration.asDays() % 30);
15
+ var hours = duration.hours();
16
+ var minutes = duration.minutes();
17
+ var remainingSeconds = duration.seconds();
18
+ var timeParts = [];
19
19
  if (years > 0) {
20
- timeParts.push(`${years}年`);
20
+ timeParts.push("".concat(years, "\u5E74"));
21
21
  }
22
22
  if (months > 0) {
23
- timeParts.push(`${months}月`);
23
+ timeParts.push("".concat(months, "\u6708"));
24
24
  }
25
25
  if (days > 0) {
26
- timeParts.push(`${days}天`);
26
+ timeParts.push("".concat(days, "\u5929"));
27
27
  }
28
28
  if (hours > 0) {
29
- timeParts.push(`${hours}小时`);
29
+ timeParts.push("".concat(hours, "\u5C0F\u65F6"));
30
30
  }
31
31
  if (minutes > 0) {
32
- timeParts.push(`${minutes}分`);
32
+ timeParts.push("".concat(minutes, "\u5206"));
33
33
  }
34
34
  if (timeParts.length === 0 || remainingSeconds > 0) {
35
- timeParts.push(`${remainingSeconds}秒`);
35
+ timeParts.push("".concat(remainingSeconds, "\u79D2"));
36
36
  }
37
37
  return timeParts.join("");
38
38
  };
@@ -5,31 +5,32 @@ import Decimal from "decimal.js";
5
5
  * @returns 计算结果
6
6
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsCalculateExpression-表达式字符串
7
7
  */
8
- export const libJsCalculateExpression = (expression, point = 2) => {
8
+ export var libJsCalculateExpression = function (expression, point) {
9
+ if (point === void 0) { point = 2; }
9
10
  //清除所有空格
10
11
  expression = expression.replace(/\s+/g, "");
11
12
  //支持的运算符和优先级
12
- const operators = {
13
+ var operators = {
13
14
  "+": 1,
14
15
  "-": 1,
15
16
  "*": 2,
16
17
  "/": 2,
17
18
  };
18
19
  //支持的小数点精度
19
- const toDecimal = (value) => new Decimal(value);
20
+ var toDecimal = function (value) { return new Decimal(value); };
20
21
  //判断字符是否是运算符
21
- const isOperator = (char) => ["+", "-", "*", "/"].includes(char);
22
+ var isOperator = function (char) { return ["+", "-", "*", "/"].includes(char); };
22
23
  //判断字符是否是数字(包括小数点)
23
- const isNumber = (char) => /[0-9.]/.test(char);
24
+ var isNumber = function (char) { return /[0-9.]/.test(char); };
24
25
  //解析表达式并计算
25
- const evaluate = (expression) => {
26
- const outputQueue = []; //输出队列
27
- const operatorStack = []; //操作符栈
28
- let i = 0;
26
+ var evaluate = function (expression) {
27
+ var outputQueue = []; //输出队列
28
+ var operatorStack = []; //操作符栈
29
+ var i = 0;
29
30
  while (i < expression.length) {
30
- const char = expression[i];
31
+ var char = expression[i];
31
32
  if (isNumber(char)) {
32
- let numStr = "";
33
+ var numStr = "";
33
34
  //处理多位数字(支持小数)
34
35
  while (i < expression.length && isNumber(expression[i])) {
35
36
  numStr += expression[i];
@@ -60,7 +61,7 @@ export const libJsCalculateExpression = (expression, point = 2) => {
60
61
  i++;
61
62
  }
62
63
  else {
63
- throw new Error(`无效字符: ${char}`);
64
+ throw new Error("\u65E0\u6548\u5B57\u7B26: ".concat(char));
64
65
  }
65
66
  }
66
67
  //把所有剩余的操作符添加到输出队列
@@ -68,11 +69,12 @@ export const libJsCalculateExpression = (expression, point = 2) => {
68
69
  outputQueue.push(operatorStack.pop());
69
70
  }
70
71
  //执行运算
71
- const calcStack = [];
72
- for (let token of outputQueue) {
72
+ var calcStack = [];
73
+ for (var _i = 0, outputQueue_1 = outputQueue; _i < outputQueue_1.length; _i++) {
74
+ var token = outputQueue_1[_i];
73
75
  if (typeof token === "string") {
74
- const b = calcStack.pop();
75
- const a = calcStack.pop();
76
+ var b = calcStack.pop();
77
+ var a = calcStack.pop();
76
78
  switch (token) {
77
79
  case "+":
78
80
  calcStack.push(a.add(b));
@@ -98,7 +100,7 @@ export const libJsCalculateExpression = (expression, point = 2) => {
98
100
  };
99
101
  try {
100
102
  //调用计算器并返回结果
101
- const result = evaluate(expression);
103
+ var result = evaluate(expression);
102
104
  return Number(result.toFixed(point)); //保留指定的小数位数
103
105
  }
104
106
  catch (error) {
@@ -4,7 +4,7 @@
4
4
  * @param type 角度类型或弧度类型
5
5
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsConvertAngle-角弧度互转
6
6
  */
7
- export const libJsConvertAngle = (value, type) => {
7
+ export var libJsConvertAngle = function (value, type) {
8
8
  if (type === "rad") {
9
9
  return value * (Math.PI / 180);
10
10
  }
@@ -3,14 +3,14 @@
3
3
  * @param coord2 终点坐标
4
4
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsCoordsAngle-两点角度
5
5
  */
6
- export const libJsCoordsAngle = (coord1, coord2) => {
6
+ export var libJsCoordsAngle = function (coord1, coord2) {
7
7
  //计算相对于第一个坐标的水平和垂直距离
8
- const deltaX = coord2.x - coord1.x;
9
- const deltaY = coord2.y - coord1.y;
8
+ var deltaX = coord2.x - coord1.x;
9
+ var deltaY = coord2.y - coord1.y;
10
10
  //使用反三角函数计算角度(以弧度为单位)
11
- const angleRad = Math.atan2(deltaY, deltaX);
11
+ var angleRad = Math.atan2(deltaY, deltaX);
12
12
  //将弧度转换为角度
13
- let angleDeg = angleRad * (180 / Math.PI);
13
+ var angleDeg = angleRad * (180 / Math.PI);
14
14
  //将角度转换为顺时针方向为正方向的角度
15
15
  angleDeg = -angleDeg + 90;
16
16
  //调整角度使得右边成为 360 度的位置变为 0 度
@@ -3,11 +3,11 @@
3
3
  * @param coord2 终点坐标
4
4
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsCoordsDistance-两点距离
5
5
  */
6
- export const libJsCoordsDistance = (coord1, coord2) => {
6
+ export var libJsCoordsDistance = function (coord1, coord2) {
7
7
  //计算两个坐标之间的水平和垂直距离
8
- const deltaX = coord2.x - coord1.x;
9
- const deltaY = coord2.y - coord1.y;
8
+ var deltaX = coord2.x - coord1.x;
9
+ var deltaY = coord2.y - coord1.y;
10
10
  //使用勾股定理计算两点之间的距离
11
- const distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
11
+ var distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
12
12
  return distance;
13
13
  };
@@ -5,18 +5,19 @@ import { Decimal } from "decimal.js";
5
5
  * @param operator 运算符,支持加减乘除
6
6
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsDecimal-高精度计算
7
7
  */
8
- export const libJsDecimal = (num1, num2, operator, point = 2) => {
9
- const calc = {
10
- "+": (a, b) => a.add(b),
11
- "-": (a, b) => a.sub(b),
12
- "*": (a, b) => a.mul(b),
13
- "/": (a, b) => {
8
+ export var libJsDecimal = function (num1, num2, operator, point) {
9
+ if (point === void 0) { point = 2; }
10
+ var calc = {
11
+ "+": function (a, b) { return a.add(b); },
12
+ "-": function (a, b) { return a.sub(b); },
13
+ "*": function (a, b) { return a.mul(b); },
14
+ "/": function (a, b) {
14
15
  if (b.eq(0)) {
15
16
  throw new Error("除数不能为0");
16
17
  }
17
18
  return a.div(b);
18
19
  },
19
20
  };
20
- const result = calc[operator](new Decimal(num1), new Decimal(num2));
21
+ var result = calc[operator](new Decimal(num1), new Decimal(num2));
21
22
  return Number(result.toFixed(point));
22
23
  };
@@ -5,15 +5,15 @@
5
5
  * @returns 验证结果数组,包含未通过验证的项
6
6
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsRegFormValidate-表单验证
7
7
  */
8
- export const libJsRegFormValidate = (form, rules) => {
9
- return rules.reduce((result, rule) => {
10
- const { key, verify, msg, name } = rule;
11
- const value = form[key];
8
+ export var libJsRegFormValidate = function (form, rules) {
9
+ return rules.reduce(function (result, rule) {
10
+ var key = rule.key, verify = rule.verify, msg = rule.msg, name = rule.name;
11
+ var value = form[key];
12
12
  if (value === "" || value === undefined || value === null) {
13
- result.push({ key, msg: "必填项", name });
13
+ result.push({ key: key, msg: "必填项", name: name });
14
14
  }
15
15
  else if (typeof verify === "function" ? !verify(value) : !verify.test(value)) {
16
- result.push({ key, msg, name });
16
+ result.push({ key: key, msg: msg, name: name });
17
17
  }
18
18
  return result;
19
19
  }, []);
@@ -5,15 +5,16 @@
5
5
  * @param params 请求参数
6
6
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsRetryRequest-请求重连
7
7
  */
8
- export const libJsRetryRequest = ({ promiseFn, maxRetries = 3, retryDelay = 2000, params = undefined, }) => {
9
- return new Promise((resolve, reject) => {
10
- let count = 0;
11
- const makeRequest = () => {
8
+ export var libJsRetryRequest = function (_a) {
9
+ var promiseFn = _a.promiseFn, _b = _a.maxRetries, maxRetries = _b === void 0 ? 3 : _b, _c = _a.retryDelay, retryDelay = _c === void 0 ? 2000 : _c, _d = _a.params, params = _d === void 0 ? undefined : _d;
10
+ return new Promise(function (resolve, reject) {
11
+ var count = 0;
12
+ var makeRequest = function () {
12
13
  promiseFn(params)
13
- .then((res) => {
14
+ .then(function (res) {
14
15
  resolve(res);
15
16
  })
16
- .catch((err) => {
17
+ .catch(function (err) {
17
18
  count++;
18
19
  if (count >= maxRetries) {
19
20
  reject(err);
@@ -1,54 +1,50 @@
1
1
  /** @description 数字步进器
2
2
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibNumerStepper-数字步进器
3
3
  */
4
- export class libNumerStepper {
5
- /** 数字变动时触发 */
6
- _onChange;
7
- /** 当前按下状态 */
8
- _isDown = false;
9
- /** 当前数字索引 */
10
- _currentIndex = 0;
11
- /** 定时器ID */
12
- _timerId;
13
- /** 计时器ID */
14
- _intervalId;
15
- /** 金额数 */
16
- _numsLength = 0;
4
+ var libNumerStepper = /** @class */ (function () {
17
5
  /**
18
6
  * @param numsLength 数字长度
19
7
  * @param onChange 数字变动时触发
20
8
  */
21
- constructor(numsLength, onChange) {
9
+ function libNumerStepper(numsLength, onChange) {
10
+ var _this = this;
11
+ /** 当前按下状态 */
12
+ this._isDown = false;
13
+ /** 当前数字索引 */
14
+ this._currentIndex = 0;
15
+ /** 金额数 */
16
+ this._numsLength = 0;
22
17
  this._onChange = onChange;
23
18
  this._numsLength = numsLength;
24
- window.addEventListener("pointerup", () => {
25
- this._isDown && this._up();
19
+ window.addEventListener("pointerup", function () {
20
+ _this._isDown && _this._up();
26
21
  });
27
22
  }
28
23
  /** @description 按下 */
29
- down(type) {
24
+ libNumerStepper.prototype.down = function (type) {
25
+ var _this = this;
30
26
  this._isDown = true;
31
27
  this._handleChange(type);
32
- this._timerId = setTimeout(() => {
33
- if (this._isDown) {
34
- this._intervalId = setInterval(() => {
35
- this._handleChange(type);
28
+ this._timerId = setTimeout(function () {
29
+ if (_this._isDown) {
30
+ _this._intervalId = setInterval(function () {
31
+ _this._handleChange(type);
36
32
  }, 100);
37
33
  }
38
34
  }, 100);
39
- }
35
+ };
40
36
  /** @description 更新索引 */
41
- updateIndex(index) {
37
+ libNumerStepper.prototype.updateIndex = function (index) {
42
38
  this._currentIndex = index;
43
- }
39
+ };
44
40
  /** @description 抬起 */
45
- _up() {
41
+ libNumerStepper.prototype._up = function () {
46
42
  this._isDown = false;
47
43
  clearTimeout(this._timerId);
48
44
  clearInterval(this._intervalId);
49
- }
45
+ };
50
46
  /** @description 处理数字变化 */
51
- _handleChange(type) {
47
+ libNumerStepper.prototype._handleChange = function (type) {
52
48
  if (type === "add") {
53
49
  if (this._currentIndex < this._numsLength - 1) {
54
50
  this._currentIndex++;
@@ -61,5 +57,7 @@ export class libNumerStepper {
61
57
  this._onChange(this._currentIndex);
62
58
  }
63
59
  }
64
- }
65
- }
60
+ };
61
+ return libNumerStepper;
62
+ }());
63
+ export { libNumerStepper };
@@ -2,4 +2,6 @@
2
2
  * @param probability 触发概率,百分比,0-100
3
3
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsProbabilityResult-概率触发
4
4
  */
5
- export const libJsProbabilityResult = (probability) => Math.random() * 100 < probability;
5
+ export var libJsProbabilityResult = function (probability) {
6
+ return Math.random() * 100 < probability;
7
+ };
@@ -4,6 +4,7 @@
4
4
  * @param num 保留小数位数
5
5
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsRandom-随机数
6
6
  */
7
- export const libJsRandom = (min, max, num = 0) => {
7
+ export var libJsRandom = function (min, max, num) {
8
+ if (num === void 0) { num = 0; }
8
9
  return parseFloat((Math.random() * (max - min) + min).toFixed(num));
9
10
  };
@@ -2,9 +2,10 @@
2
2
  * @param alpha 透明度
3
3
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsRandomColor-随机色
4
4
  */
5
- export const libJsRandomColor = (alpha = 1) => {
6
- const r = Math.floor(Math.random() * 256);
7
- const g = Math.floor(Math.random() * 256);
8
- const b = Math.floor(Math.random() * 256);
9
- return `rgba(${r}, ${g}, ${b}, ${alpha})`;
5
+ export var libJsRandomColor = function (alpha) {
6
+ if (alpha === void 0) { alpha = 1; }
7
+ var r = Math.floor(Math.random() * 256);
8
+ var g = Math.floor(Math.random() * 256);
9
+ var b = Math.floor(Math.random() * 256);
10
+ return "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(alpha, ")");
10
11
  };
@@ -4,11 +4,12 @@
4
4
  * @param count 数组长度
5
5
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsUniqueRandomNumbers-随机数数组
6
6
  */
7
- export const libJsUniqueRandomNumbers = (min, max, count) => {
8
- const numbers = Array.from({ length: max - min + 1 }, (_, i) => i + min);
9
- for (let i = numbers.length - 1; i > 0; i--) {
10
- const j = Math.floor(Math.random() * (i + 1));
11
- [numbers[i], numbers[j]] = [numbers[j], numbers[i]];
7
+ export var libJsUniqueRandomNumbers = function (min, max, count) {
8
+ var _a;
9
+ var numbers = Array.from({ length: max - min + 1 }, function (_, i) { return i + min; });
10
+ for (var i = numbers.length - 1; i > 0; i--) {
11
+ var j = Math.floor(Math.random() * (i + 1));
12
+ _a = [numbers[j], numbers[i]], numbers[i] = _a[0], numbers[j] = _a[1];
12
13
  }
13
14
  return numbers.slice(0, count);
14
15
  };
@@ -6,9 +6,9 @@ import dayjs from "dayjs";
6
6
  * @returns 0-同一单位时间 1-新单位时间 -1时间戳大于当前时间
7
7
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsSameTimeCheck-时间比对
8
8
  */
9
- export const libJsSameTimeCheck = (timestamp, unit) => {
10
- const inputTime = dayjs(timestamp).startOf(unit);
11
- const currentTime = dayjs().startOf(unit);
9
+ export var libJsSameTimeCheck = function (timestamp, unit) {
10
+ var inputTime = dayjs(timestamp).startOf(unit);
11
+ var currentTime = dayjs().startOf(unit);
12
12
  if (inputTime.isSame(currentTime)) {
13
13
  return 0;
14
14
  }
@@ -2,8 +2,8 @@
2
2
  * @param timestamp 毫秒时间戳
3
3
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsTimeAgo-中文时间差
4
4
  */
5
- export const libJsTimeAgo = (timestamp) => {
6
- const timeUnits = [
5
+ export var libJsTimeAgo = function (timestamp) {
6
+ var timeUnits = [
7
7
  { unit: "年", milliseconds: 365 * 24 * 60 * 60 * 1000 },
8
8
  { unit: "月", milliseconds: 30 * 24 * 60 * 60 * 1000 },
9
9
  { unit: "周", milliseconds: 7 * 24 * 60 * 60 * 1000 },
@@ -11,12 +11,13 @@ export const libJsTimeAgo = (timestamp) => {
11
11
  { unit: "小时", milliseconds: 60 * 60 * 1000 },
12
12
  { unit: "分钟", milliseconds: 60 * 1000 },
13
13
  ];
14
- const currentTime = Date.now();
15
- const timeDifference = currentTime - timestamp;
16
- for (const { unit, milliseconds } of timeUnits) {
14
+ var currentTime = Date.now();
15
+ var timeDifference = currentTime - timestamp;
16
+ for (var _i = 0, timeUnits_1 = timeUnits; _i < timeUnits_1.length; _i++) {
17
+ var _a = timeUnits_1[_i], unit = _a.unit, milliseconds = _a.milliseconds;
17
18
  if (timeDifference >= milliseconds) {
18
- const count = Math.floor(timeDifference / milliseconds);
19
- return `${count} ${unit}前`;
19
+ var count = Math.floor(timeDifference / milliseconds);
20
+ return "".concat(count, " ").concat(unit, "\u524D");
20
21
  }
21
22
  }
22
23
  return "刚刚";
@@ -3,9 +3,10 @@
3
3
  * @param greet 自定义问候语对象
4
4
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsTimeGreeting-时间问候
5
5
  */
6
- export const libJsTimeGreeting = (greet = {}) => {
7
- const { midnight = "午夜好", morning = "早上好", forenoon = "上午好", noon = "中午好", afternoon = "下午好", evening = "晚上好", } = greet;
8
- const now = new Date().getHours();
6
+ export var libJsTimeGreeting = function (greet) {
7
+ if (greet === void 0) { greet = {}; }
8
+ var _a = greet.midnight, midnight = _a === void 0 ? "午夜好" : _a, _b = greet.morning, morning = _b === void 0 ? "早上好" : _b, _c = greet.forenoon, forenoon = _c === void 0 ? "上午好" : _c, _d = greet.noon, noon = _d === void 0 ? "中午好" : _d, _e = greet.afternoon, afternoon = _e === void 0 ? "下午好" : _e, _f = greet.evening, evening = _f === void 0 ? "晚上好" : _f;
9
+ var now = new Date().getHours();
9
10
  return now < 4
10
11
  ? midnight
11
12
  : now < 10
package/dist/libJs.d.ts CHANGED
@@ -88,7 +88,6 @@ export declare const Data: {
88
88
  libJsMatchEmail: (str: string, emailList: string[]) => string[];
89
89
  /** @description 数组乱序
90
90
  * @param arr 需要乱序的数组
91
- * @link 了解更多:https://www.npmjs.com/package/lyb-js
92
91
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsShuffleArray-数组乱序
93
92
  */
94
93
  libJsShuffleArray: <T>(arr: T[]) => T[];
@@ -154,7 +153,9 @@ export declare const Formatter: {
154
153
  * @returns [数字, 单位]
155
154
  * @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsNumberUnit-数字单位
156
155
  */
157
- libJsNumberUnit: (num: number, units: import("./Formatter/LibJsNumberUnit").LibJsNumberUnitParams) => string[];
156
+ libJsNumberUnit: (num: number, units: {
157
+ string: number;
158
+ }, point?: number) => string[];
158
159
  /**
159
160
  * @description 将秒数格式化为中文时间描述,支持扩展到年和月
160
161
  * @param seconds 秒数