mm_expand 2.4.2 → 2.4.3

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.
package/lib/global.js CHANGED
@@ -21,6 +21,7 @@ function sleep(milli_seconds, obj, key) {
21
21
 
22
22
  if (!obj) {
23
23
  simpleSleep(end_time);
24
+ return;
24
25
  }
25
26
 
26
27
  if (key) {
@@ -278,7 +279,7 @@ if (!global.$) {
278
279
  }
279
280
 
280
281
  // 先判断基本类型
281
- compareBasic(source, target);
282
+ var basic_result = compareBasic(source, target);
282
283
  if (basic_result !== null) {
283
284
  return basic_result;
284
285
  }
package/lib/lang.js CHANGED
@@ -6,7 +6,7 @@ const { Base } = require('./base.js');
6
6
  */
7
7
  class Lang extends Base {
8
8
  static config = {
9
- zhCn: {},
9
+ zh_cn: {},
10
10
  en: {},
11
11
  default: 'zh_cn',
12
12
  fallback: true
@@ -27,7 +27,7 @@ class Lang extends Base {
27
27
  en(count) {
28
28
  return count === 1 ? 0 : 1;
29
29
  },
30
- zhCn() {
30
+ zh_cn(count) {
31
31
  return 0;
32
32
  }
33
33
  };
@@ -345,8 +345,8 @@ Lang.prototype.formatDate = function (dt, format = 'YYYY-MM-DD hh:mm:ss') {
345
345
  * @param {number} num - 要格式化的数字
346
346
  * @param {object} [options] - 选项
347
347
  * @param {number} [options.decimals=2] - 小数位数
348
- * @param {string} [options.decimalSeparator] - 小数分隔符
349
- * @param {string} [options.thousandsSeparator] - 千位分隔符
348
+ * @param {string} [options.decimal_separator] - 小数分隔符
349
+ * @param {string} [options.thousands_separator] - 千位分隔符
350
350
  * @returns {string} 格式化后的数字字符串
351
351
  */
352
352
  Lang.prototype.formatNumber = function (num, options = {}) {
@@ -359,8 +359,8 @@ Lang.prototype.formatNumber = function (num, options = {}) {
359
359
  var decimals = typeof opt.decimals === 'number' ? opt.decimals : 2;
360
360
 
361
361
  // 获取语言特定的分隔符
362
- var decimal_sepa = opt.decimalSeparator || '.';
363
- var thou_sepa = opt.thousandsSeparator || ',';
362
+ var decimal_sepa = opt.decimal_separator || '.';
363
+ var thou_sepa = opt.thousands_separator || ',';
364
364
 
365
365
  // 格式化数字
366
366
  var parts = num.toFixed(decimals).split('.');
package/lib/logger.js CHANGED
@@ -67,7 +67,7 @@ Logger.prototype.debug = function (message, ...args) {
67
67
  this.emit('debug:after', ctx);
68
68
  } catch (error) {
69
69
  // 日志错误处理
70
- this._logger.error(error);
70
+ this.getLogger().error(error);
71
71
  }
72
72
  };
73
73
 
@@ -130,7 +130,7 @@ Logger.prototype.warn = function (message, ...args) {
130
130
  this.emit('warn:after', ctx);
131
131
  } catch (error) {
132
132
  // 日志错误处理
133
- this._logger.error(error);
133
+ this.getLogger().error(error);
134
134
  }
135
135
  };
136
136
 
package/lib/string.js CHANGED
@@ -57,7 +57,7 @@ String.prototype.aesEncode = function (key, iv) {
57
57
  chunks.push(cipher.final(encoding));
58
58
  return chunks.join('');
59
59
  } catch (error) {
60
- throw new Error('AES加密错误:', error);
60
+ throw new Error('AES加密错误: ' + error.message);
61
61
  }
62
62
  };
63
63
 
@@ -83,7 +83,7 @@ String.prototype.aesDecode = function (key, iv) {
83
83
  chunks.push(decipher.final(encoding));
84
84
  return chunks.join('');
85
85
  } catch (error) {
86
- throw new Error('AES解密错误:', error);
86
+ throw new Error('AES解密错误: ' + error.message);
87
87
  }
88
88
  };
89
89
 
@@ -123,7 +123,7 @@ String.prototype.toJson = function () {
123
123
  try {
124
124
  return json5.parse(this);
125
125
  } catch (error) {
126
- throw new Error('json反序列化错误', error);
126
+ throw new Error('json反序列化错误: ' + error.message);
127
127
  }
128
128
  };
129
129
  /**
@@ -135,7 +135,7 @@ String.prototype.toXml = function () {
135
135
  const parser = new XmlParser();
136
136
  return parser.parse(this);
137
137
  } catch (error) {
138
- throw new Error('xml反序列化错误!', error);
138
+ throw new Error('xml反序列化错误: ' + error.message);
139
139
  }
140
140
  };
141
141
  /**
@@ -385,8 +385,8 @@ String.prototype.addSeconds = function (seconds, format) {
385
385
  }
386
386
 
387
387
  // 降级处理
388
- const newTime = new Date(date.getTime() + seconds * 1000);
389
- return format ? newTime.toISOString() : newTime;
388
+ const new_time = new Date(date.getTime() + seconds * 1000);
389
+ return format ? new_time.toISOString() : new_time;
390
390
  };
391
391
 
392
392
  /**
@@ -409,8 +409,8 @@ String.prototype.addDays = function (days, format) {
409
409
  }
410
410
 
411
411
  // 降级处理
412
- const newTime = new Date(date.getTime() + days * 24 * 60 * 60 * 1000);
413
- return format ? newTime.toISOString() : newTime;
412
+ const new_time = new Date(date.getTime() + days * 24 * 60 * 60 * 1000);
413
+ return format ? new_time.toISOString() : new_time;
414
414
  };
415
415
 
416
416
  /**
@@ -480,7 +480,7 @@ String.prototype.toRx = function (mode) {
480
480
  let pattern = this.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
481
481
  return new RegExp(pattern, _mode);
482
482
  } catch (error) {
483
- throw new Error('字符串转正则错误:', error);
483
+ throw new Error('字符串转正则错误: ' + error.message);
484
484
  }
485
485
  };
486
486
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mm_expand",
3
- "version": "2.4.2",
3
+ "version": "2.4.3",
4
4
  "description": "超级美眉原型函数扩展模块 - 增强的字符串、数组、对象、日期操作,具备错误预防功能并简化业务逻辑",
5
5
  "main": "index.js",
6
6
  "scripts": {