mm_expand 2.3.4 → 2.3.6

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/validator.js CHANGED
@@ -11,8 +11,8 @@ class Validator extends Base {
11
11
  static get format() {
12
12
  return Object.assign(
13
13
  Validator._getBasicFormats(),
14
- Validator._getEcommerceFormats(),
15
- Validator._getFinancialFormats(),
14
+ Validator._getEcomFormats(),
15
+ Validator._getFinaFormats(),
16
16
  Validator._getGeoFormats()
17
17
  );
18
18
  }
@@ -27,7 +27,7 @@ class Validator extends Base {
27
27
  Validator._getBasicDateTime(),
28
28
  Validator._getBasicText(),
29
29
  Validator._getBasicNetwork(),
30
- Validator._getBasicData(),
30
+ Validator._getBasic(),
31
31
  Validator._getBasicTech()
32
32
  );
33
33
  }
@@ -107,7 +107,7 @@ class Validator extends Base {
107
107
  * 获取电商相关验证格式
108
108
  * @returns {object} 电商验证格式
109
109
  */
110
- static _getEcommerceFormats() {
110
+ static _getEcomFormats() {
111
111
  return {
112
112
  sku: /^[A-Z0-9]{6,20}$/, // 商品SKU编码
113
113
  order_no: /^[A-Z0-9]{10,20}$/, // 订单号
@@ -123,7 +123,7 @@ class Validator extends Base {
123
123
  * 获取金融相关验证格式
124
124
  * @returns {object} 金融验证格式
125
125
  */
126
- static _getFinancialFormats() {
126
+ static _getFinaFormats() {
127
127
  return {
128
128
  bank_account: /^[0-9]{16,19}$/, // 银行账号
129
129
  credit_card: /^[0-9]{13,19}$/, // 信用卡号
@@ -140,7 +140,7 @@ class Validator extends Base {
140
140
  * 获取基础数据格式
141
141
  * @returns {object} 数据格式
142
142
  */
143
- static _getBasicData() {
143
+ static _getBasic() {
144
144
  return {
145
145
  number: /^[1-9]+[0-9]*(\.[0-9]+|[0-9]*)|0\.[0-9]+|0$/,
146
146
  num: /^-?(?:0|[1-9]\d*)(?:\.\d+)?$/,
@@ -201,7 +201,7 @@ class Validator extends Base {
201
201
 
202
202
  /**
203
203
  * 初始化验证规则
204
- * @description 初始化验证规则,避免污染
204
+ * 初始化验证规则,避免污染
205
205
  */
206
206
  Validator.prototype.reset = function () {
207
207
  // 初始化验证规则,避免污染
@@ -1231,7 +1231,7 @@ Validator.prototype.isDistrictCode = function (val) {
1231
1231
  * @param {string} data_type 数据类型
1232
1232
  * @returns {object} 类型信息对象
1233
1233
  */
1234
- Validator.prototype.getDataTypeInfo = function (data_type) {
1234
+ Validator.prototype.getTypeInfo = function (data_type) {
1235
1235
  const type_map = {
1236
1236
  'string': ['char', 'varchar', 'text'],
1237
1237
  'number': ['bigint', 'int', 'double', 'float', 'mediumint', 'smallint', 'tinyint'],
@@ -1291,7 +1291,7 @@ Validator.prototype.createRuleObject = function (options) {
1291
1291
  */
1292
1292
  Validator.prototype.newRule = function (data_type = 'text', min = 0,
1293
1293
  max = Number.MAX_SAFE_INTEGER) {
1294
- const { type, check_type } = this.getDataTypeInfo(data_type);
1294
+ const { type, check_type } = this.getTypeInfo(data_type);
1295
1295
  return this.createRuleObject({ type, check_type, min, max });
1296
1296
  };
1297
1297
 
@@ -1423,7 +1423,7 @@ Validator.prototype.checkSame = function (val, rule, obj) {
1423
1423
  * @param {object} obj 数据对象
1424
1424
  * @returns {string} 错误信息或空字符串
1425
1425
  */
1426
- Validator.prototype.checkDifferent = function (val, rule, obj) {
1426
+ Validator.prototype.checkDiff = function (val, rule, obj) {
1427
1427
  if (rule.different) {
1428
1428
  let target_val = obj[rule.different];
1429
1429
  if (val === target_val) {
@@ -1505,7 +1505,7 @@ Validator.prototype.checkVal = function (obj, key, rule) {
1505
1505
  tip = this.checkSame(val, rule, obj);
1506
1506
  if (tip) return tip;
1507
1507
 
1508
- tip = this.checkDifferent(val, rule, obj);
1508
+ tip = this.checkDiff(val, rule, obj);
1509
1509
  if (tip) return tip;
1510
1510
 
1511
1511
  return '';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mm_expand",
3
- "version": "2.3.4",
3
+ "version": "2.3.6",
4
4
  "description": "超级美眉原型函数扩展模块 - 增强的字符串、数组、对象、日期操作,具备错误预防功能并简化业务逻辑",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -34,7 +34,7 @@
34
34
  "homepage": "https://gitee.com/qiuwenwu91/mm_expand#readme",
35
35
  "dependencies": {
36
36
  "colors": "^1.4.0",
37
- "fast-xml-parser": "^5.7.2",
37
+ "fast-xml-parser": "^5.9.3",
38
38
  "json5": "^2.2.3",
39
39
  "ncp": "^2.0.0",
40
40
  "pinyinlite": "^1.2.1",
@@ -45,9 +45,9 @@
45
45
  "test": "test"
46
46
  },
47
47
  "devDependencies": {
48
- "eslint": "^10.2.1",
49
- "eslint-plugin-jsdoc": "^62.9.0",
50
- "mm_eslint": "^1.7.1"
48
+ "eslint": "^10.6.0",
49
+ "eslint-plugin-jsdoc": "^63.0.10",
50
+ "mm_eslint": "^1.7.5"
51
51
  },
52
52
  "engines": {
53
53
  "node": ">=14.0.0"
@@ -62,4 +62,4 @@
62
62
  "publishConfig": {
63
63
  "access": "public"
64
64
  }
65
- }
65
+ }