util-helpers 4.17.3 → 4.18.0

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 (159) hide show
  1. package/README.md +1 -1
  2. package/dist/util-helpers.js +305 -186
  3. package/dist/util-helpers.js.map +1 -1
  4. package/dist/util-helpers.min.js +1 -1
  5. package/dist/util-helpers.min.js.map +1 -1
  6. package/esm/VERSION.js +4 -0
  7. package/esm/calculateCursorPosition.js +3 -3
  8. package/esm/divide.js +2 -2
  9. package/esm/download.js +1 -2
  10. package/esm/filterTree.js +1 -1
  11. package/esm/findTreeNode.js +1 -1
  12. package/esm/findTreeNodes.js +1 -1
  13. package/esm/findTreeSelect.js +1 -1
  14. package/esm/formatBankCard.js +2 -2
  15. package/esm/formatMobile.js +2 -2
  16. package/esm/formatMoney.js +3 -3
  17. package/esm/index.js +6 -1
  18. package/esm/isBankCard.js +2 -2
  19. package/esm/isBusinessLicense.js +2 -2
  20. package/esm/isChinese.js +2 -2
  21. package/esm/isEmail.js +2 -2
  22. package/esm/isHMCard.js +2 -2
  23. package/esm/isIPv4.js +2 -2
  24. package/esm/isIPv6.js +2 -2
  25. package/esm/isIdCard.js +2 -2
  26. package/esm/isMobile.js +2 -2
  27. package/esm/isPassport.js +2 -2
  28. package/esm/isPostcode.js +2 -2
  29. package/esm/isPromiseLike.js +3 -1
  30. package/esm/isQQ.js +2 -2
  31. package/esm/isSocialCreditCode.js +2 -2
  32. package/esm/isSwiftCode.js +2 -2
  33. package/esm/isTWCard.js +2 -2
  34. package/esm/isTelephone.js +2 -2
  35. package/esm/isUrl.js +2 -2
  36. package/esm/isValidNumber.js +1 -1
  37. package/esm/isVehicle.js +2 -2
  38. package/esm/isWX.js +2 -2
  39. package/esm/listToTree.js +1 -1
  40. package/esm/minus.js +2 -2
  41. package/esm/normalizeString.js +2 -6
  42. package/esm/padZero.js +2 -2
  43. package/esm/plus.js +2 -2
  44. package/esm/replaceChar.js +2 -2
  45. package/esm/round.js +2 -2
  46. package/esm/strlen.js +2 -2
  47. package/esm/times.js +2 -2
  48. package/esm/transformFieldNames.js +1 -1
  49. package/esm/treeToList.js +1 -1
  50. package/esm/utils/config.js +1 -2
  51. package/esm/utils/math.util.js +1 -4
  52. package/esm/waitTime.js +3 -3
  53. package/lib/VERSION.js +6 -0
  54. package/lib/calculateCursorPosition.js +3 -3
  55. package/lib/divide.js +2 -2
  56. package/lib/download.js +4 -5
  57. package/lib/filterTree.js +3 -3
  58. package/lib/findTreeNode.js +2 -2
  59. package/lib/findTreeNodes.js +2 -2
  60. package/lib/findTreeSelect.js +2 -2
  61. package/lib/formatBankCard.js +2 -2
  62. package/lib/formatMobile.js +2 -2
  63. package/lib/formatMoney.js +3 -3
  64. package/lib/index.js +3 -5
  65. package/lib/isBankCard.js +2 -2
  66. package/lib/isBusinessLicense.js +2 -2
  67. package/lib/isChinese.js +2 -2
  68. package/lib/isEmail.js +2 -2
  69. package/lib/isHMCard.js +2 -2
  70. package/lib/isIPv4.js +2 -2
  71. package/lib/isIPv6.js +2 -2
  72. package/lib/isIdCard.js +2 -2
  73. package/lib/isMobile.js +2 -2
  74. package/lib/isPassport.js +2 -2
  75. package/lib/isPostcode.js +2 -2
  76. package/lib/isPromiseLike.js +3 -1
  77. package/lib/isQQ.js +2 -2
  78. package/lib/isSocialCreditCode.js +2 -2
  79. package/lib/isSwiftCode.js +2 -2
  80. package/lib/isTWCard.js +2 -2
  81. package/lib/isTelephone.js +2 -2
  82. package/lib/isUrl.js +2 -2
  83. package/lib/isValidNumber.js +2 -2
  84. package/lib/isVehicle.js +2 -2
  85. package/lib/isWX.js +2 -2
  86. package/lib/listToTree.js +2 -2
  87. package/lib/minus.js +2 -2
  88. package/lib/normalizeString.js +2 -6
  89. package/lib/padZero.js +2 -2
  90. package/lib/plus.js +2 -2
  91. package/lib/replaceChar.js +2 -2
  92. package/lib/round.js +2 -2
  93. package/lib/strlen.js +2 -2
  94. package/lib/times.js +2 -2
  95. package/lib/transformFieldNames.js +2 -2
  96. package/lib/treeToList.js +2 -2
  97. package/lib/utils/config.js +0 -1
  98. package/lib/utils/math.util.js +5 -8
  99. package/lib/waitTime.js +3 -3
  100. package/package.json +3 -2
  101. package/types/VERSION.d.ts +8 -0
  102. package/types/formatBankCard.d.ts +1 -1
  103. package/types/formatMobile.d.ts +1 -1
  104. package/types/index.d.ts +7 -1
  105. package/types/isPromiseLike.d.ts +1 -0
  106. package/types/normalizeString.d.ts +2 -1
  107. package/types/padZero.d.ts +1 -1
  108. package/types/replaceChar.d.ts +4 -1
  109. package/types/utils/config.d.ts +1 -2
  110. package/types/waitTime.d.ts +2 -1
  111. package/esm/utils/constants.js +0 -4
  112. package/esm/utils/convertToString.js +0 -7
  113. package/esm/utils/type/isBlob.js +0 -7
  114. package/esm/utils/type/isNaN.js +0 -7
  115. package/esm/utils/type/isNil.js +0 -8
  116. package/esm/utils/type/isNull.js +0 -5
  117. package/esm/utils/type/isNumber.js +0 -7
  118. package/esm/utils/type/isObject.js +0 -6
  119. package/esm/utils/type/isString.js +0 -7
  120. package/esm/utils/type/isSymbol.js +0 -7
  121. package/esm/utils/type/isType.js +0 -6
  122. package/esm/utils/type/isUndefined.js +0 -5
  123. package/lib/utils/constants.js +0 -4
  124. package/lib/utils/convertToString.js +0 -9
  125. package/lib/utils/type/isBlob.js +0 -9
  126. package/lib/utils/type/isNaN.js +0 -9
  127. package/lib/utils/type/isNil.js +0 -10
  128. package/lib/utils/type/isNull.js +0 -7
  129. package/lib/utils/type/isNumber.js +0 -9
  130. package/lib/utils/type/isObject.js +0 -8
  131. package/lib/utils/type/isString.js +0 -9
  132. package/lib/utils/type/isSymbol.js +0 -9
  133. package/lib/utils/type/isType.js +0 -8
  134. package/lib/utils/type/isUndefined.js +0 -7
  135. package/types/utils/constants.d.ts +0 -2
  136. package/types/utils/convertToString.d.ts +0 -8
  137. package/types/utils/type/index.d.ts +0 -28
  138. package/types/utils/type/isArguments.d.ts +0 -18
  139. package/types/utils/type/isArray.d.ts +0 -18
  140. package/types/utils/type/isArrayBuffer.d.ts +0 -21
  141. package/types/utils/type/isBlob.d.ts +0 -23
  142. package/types/utils/type/isBoolean.d.ts +0 -18
  143. package/types/utils/type/isDate.d.ts +0 -18
  144. package/types/utils/type/isError.d.ts +0 -18
  145. package/types/utils/type/isFunction.d.ts +0 -18
  146. package/types/utils/type/isMap.d.ts +0 -18
  147. package/types/utils/type/isNaN.d.ts +0 -18
  148. package/types/utils/type/isNil.d.ts +0 -11
  149. package/types/utils/type/isNull.d.ts +0 -18
  150. package/types/utils/type/isNumber.d.ts +0 -27
  151. package/types/utils/type/isObject.d.ts +0 -21
  152. package/types/utils/type/isRegExp.d.ts +0 -18
  153. package/types/utils/type/isSet.d.ts +0 -18
  154. package/types/utils/type/isString.d.ts +0 -18
  155. package/types/utils/type/isSymbol.d.ts +0 -18
  156. package/types/utils/type/isType.d.ts +0 -11
  157. package/types/utils/type/isUndefined.d.ts +0 -21
  158. package/types/utils/type/isWeakMap.d.ts +0 -18
  159. package/types/utils/type/isWeakSet.d.ts +0 -18
@@ -4,53 +4,295 @@
4
4
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.utilHelpers = {}));
5
5
  })(this, (function (exports) { 'use strict';
6
6
 
7
- function isUndefined(value) {
8
- return value === void 0;
7
+ function isArray(value) {
8
+ return Array.isArray(value);
9
+ }
10
+
11
+ var freeGlobalThis = typeof globalThis === 'object' && globalThis && globalThis.Object === Object && globalThis;
12
+ var freeGlobal = typeof global === 'object' && global && global.Object === Object && global;
13
+ var freeSelf = typeof self === 'object' && self && self.Object === Object && self;
14
+ var root = freeGlobalThis || freeGlobal || freeSelf || Function('return this')() || {};
15
+ var objectProto = Object.prototype;
16
+ var objectToString = objectProto.toString;
17
+ var hasOwnProperty = objectProto.hasOwnProperty;
18
+ var functionToString = Function.prototype.toString;
19
+ functionToString.call(Object);
20
+ var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
21
+ var MIN_SAFE_INTEGER = Number.MIN_SAFE_INTEGER || -9007199254740991;
22
+ var blobExisted = typeof Blob !== 'undefined';
23
+ function toSource(func) {
24
+ if (func !== null) {
25
+ try {
26
+ return functionToString.call(func);
27
+ }
28
+ catch (e) {
29
+ }
30
+ try {
31
+ return func + '';
32
+ }
33
+ catch (e) {
34
+ }
35
+ }
36
+ return '';
37
+ }
38
+ var objectTag = '[object Object]';
39
+ var dataViewTag = '[object DataView]';
40
+ var mapTag = '[object Map]';
41
+ var promiseTag = '[object Promise]';
42
+ var setTag = '[object Set]';
43
+ var weakMapTag = '[object WeakMap]';
44
+ var dataViewExisted = typeof DataView !== 'undefined';
45
+ var mapExisted = typeof Map !== 'undefined';
46
+ var promiseExisted = typeof Promise !== 'undefined';
47
+ var setExisted = typeof Set !== 'undefined';
48
+ var weakMapExisted = typeof WeakMap !== 'undefined';
49
+ var initSource = function (existed, str) { return (existed ? str : ''); };
50
+ var dataViewCtorString = initSource(dataViewExisted, toSource(DataView));
51
+ var mapCtorString = initSource(mapExisted, toSource(Map));
52
+ var promiseCtorString = initSource(promiseExisted, toSource(Promise));
53
+ var setCtorString = initSource(setExisted, toSource(Set));
54
+ var weakMapCtorString = initSource(weakMapExisted, toSource(WeakMap));
55
+
56
+ function isObject(value) {
57
+ var type = typeof value;
58
+ return value != null && (type === 'object' || type === 'function');
9
59
  }
10
60
 
11
- function isNull(value) {
12
- return value === null;
61
+ function getRawTag(value) {
62
+ var isOwn = hasOwnProperty.call(value, Symbol.toStringTag);
63
+ var tag = value[Symbol.toStringTag];
64
+ var unmasked = false;
65
+ try {
66
+ value[Symbol.toStringTag] = undefined;
67
+ unmasked = true;
68
+ }
69
+ catch (e) {
70
+ }
71
+ var result = objectToString.call(value);
72
+ if (unmasked) {
73
+ if (isOwn) {
74
+ value[Symbol.toStringTag] = tag;
75
+ }
76
+ else {
77
+ delete value[Symbol.toStringTag];
78
+ }
79
+ }
80
+ return result;
13
81
  }
82
+ function _getTag(value) {
83
+ return Symbol && Symbol.toStringTag && Symbol.toStringTag in Object(value)
84
+ ? getRawTag(value)
85
+ : objectToString.call(value);
86
+ }
87
+ var getTag = _getTag;
88
+ if ((dataViewExisted && objectToString.call(new DataView(new ArrayBuffer(1))) !== dataViewTag) ||
89
+ (mapExisted && objectToString.call(new Map()) !== mapTag) ||
90
+ (promiseExisted && objectToString.call(Promise.resolve()) !== promiseTag) ||
91
+ (setExisted && objectToString.call(new Set()) !== setTag) ||
92
+ (weakMapExisted && objectToString.call(new WeakMap()) !== weakMapTag)) {
93
+ getTag = function (value) {
94
+ var result = _getTag(value);
95
+ var Ctor = result === objectTag ? value.constructor : undefined;
96
+ var ctorString = Ctor ? toSource(Ctor) : '';
97
+ if (ctorString) {
98
+ switch (ctorString) {
99
+ case dataViewCtorString:
100
+ return dataViewTag;
101
+ case mapCtorString:
102
+ return mapTag;
103
+ case promiseCtorString:
104
+ return promiseTag;
105
+ case setCtorString:
106
+ return setTag;
107
+ case weakMapCtorString:
108
+ return weakMapTag;
109
+ }
110
+ }
111
+ return result;
112
+ };
113
+ }
114
+ var getTag$1 = getTag;
14
115
 
15
- function isNil(value) {
16
- return isUndefined(value) || isNull(value);
116
+ function isType(value, type) {
117
+ var nativeTypeString = getTag$1(value);
118
+ if (typeof type === 'string') {
119
+ return nativeTypeString === '[object ' + type + ']';
120
+ }
121
+ return type.some(function (item) { return nativeTypeString === '[object ' + item + ']'; });
17
122
  }
18
123
 
19
- var toString = Object.prototype.toString;
20
- function isType(value, typename) {
21
- return toString.call(value) === "[object ".concat(typename, "]");
124
+ function isObjectLike(value) {
125
+ return value != null && typeof value === 'object';
22
126
  }
23
127
 
24
- function isString(value) {
25
- return isType(value, 'String');
128
+ function isSymbol(value) {
129
+ return typeof value === 'symbol' || (isObjectLike(value) && isType(value, 'Symbol'));
26
130
  }
27
131
 
28
- function convertToString(value) {
29
- return isString(value) ? value : String(value);
132
+ /******************************************************************************
133
+ Copyright (c) Microsoft Corporation.
134
+
135
+ Permission to use, copy, modify, and/or distribute this software for any
136
+ purpose with or without fee is hereby granted.
137
+
138
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
139
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
140
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
141
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
142
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
143
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
144
+ PERFORMANCE OF THIS SOFTWARE.
145
+ ***************************************************************************** */
146
+ /* global Reflect, Promise */
147
+
148
+
149
+ var __assign = function() {
150
+ __assign = Object.assign || function __assign(t) {
151
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
152
+ s = arguments[i];
153
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
154
+ }
155
+ return t;
156
+ };
157
+ return __assign.apply(this, arguments);
158
+ };
159
+
160
+ function __awaiter(thisArg, _arguments, P, generator) {
161
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
162
+ return new (P || (P = Promise))(function (resolve, reject) {
163
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
164
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
165
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
166
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
167
+ });
168
+ }
169
+
170
+ function __generator(thisArg, body) {
171
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
172
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
173
+ function verb(n) { return function (v) { return step([n, v]); }; }
174
+ function step(op) {
175
+ if (f) throw new TypeError("Generator is already executing.");
176
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
177
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
178
+ if (y = 0, t) op = [op[0] & 2, t.value];
179
+ switch (op[0]) {
180
+ case 0: case 1: t = op; break;
181
+ case 4: _.label++; return { value: op[1], done: false };
182
+ case 5: _.label++; y = op[1]; op = [0]; continue;
183
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
184
+ default:
185
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
186
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
187
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
188
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
189
+ if (t[2]) _.ops.pop();
190
+ _.trys.pop(); continue;
191
+ }
192
+ op = body.call(thisArg, _);
193
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
194
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
195
+ }
196
+ }
197
+
198
+ function __values(o) {
199
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
200
+ if (m) return m.call(o);
201
+ if (o && typeof o.length === "number") return {
202
+ next: function () {
203
+ if (o && i >= o.length) o = void 0;
204
+ return { value: o && o[i++], done: !o };
205
+ }
206
+ };
207
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
208
+ }
209
+
210
+ function __read(o, n) {
211
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
212
+ if (!m) return o;
213
+ var i = m.call(o), r, ar = [], e;
214
+ try {
215
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
216
+ }
217
+ catch (error) { e = { error: error }; }
218
+ finally {
219
+ try {
220
+ if (r && !r.done && (m = i["return"])) m.call(i);
221
+ }
222
+ finally { if (e) throw e.error; }
223
+ }
224
+ return ar;
225
+ }
226
+
227
+ function __spreadArray(to, from, pack) {
228
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
229
+ if (ar || !(i in from)) {
230
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
231
+ ar[i] = from[i];
232
+ }
233
+ }
234
+ return to.concat(ar || Array.prototype.slice.call(from));
30
235
  }
31
236
 
32
- function normalizeString(value) {
33
- if (isNil(value)) {
34
- return '';
237
+ function baseToString(value) {
238
+ if (typeof value === 'string') {
239
+ return value;
240
+ }
241
+ if (isArray(value)) {
242
+ return "".concat(value.map(baseToString));
35
243
  }
36
- return convertToString(value);
244
+ if (isSymbol(value)) {
245
+ return value.toString();
246
+ }
247
+ var result = '' + value;
248
+ return result == '0' && 1 / value === -Infinity ? '-0' : result;
249
+ }
250
+ function toString(value) {
251
+ return value == null ? '' : baseToString(value);
252
+ }
253
+
254
+ function isBlob(value) {
255
+ return (blobExisted && value instanceof Blob) || isType(value, ['Blob', 'File']);
256
+ }
257
+
258
+ function isNumber(value) {
259
+ return typeof value === 'number' || (isObjectLike(value) && isType(value, 'Number'));
260
+ }
261
+
262
+ function isNaN$1(value) {
263
+ return isNumber(value) && root.isNaN(value);
264
+ }
265
+
266
+ function isPromiseLike$1(value) {
267
+ return isObject(value) && typeof value.then === 'function';
268
+ }
269
+
270
+ function isString(value) {
271
+ return typeof value === 'string' || (isObjectLike(value) && isType(value, 'String'));
272
+ }
273
+
274
+ function sleep(ms) {
275
+ if (ms === void 0) { ms = 1000; }
276
+ return new Promise(function (resolve) {
277
+ setTimeout(resolve, ms);
278
+ });
37
279
  }
38
280
 
39
281
  var reg$c = /^1[3456789]\d{9}$/;
40
282
  function isMobile(value) {
41
- var valueStr = normalizeString(value);
283
+ var valueStr = toString(value);
42
284
  return reg$c.test(valueStr);
43
285
  }
44
286
 
45
287
  var reg$b = /^(0\d{2,3}-)?([2-9]\d{6,7})(-\d{1,6})?$/;
46
288
  function isTelephone(value) {
47
- var valueStr = normalizeString(value);
289
+ var valueStr = toString(value);
48
290
  return reg$b.test(valueStr);
49
291
  }
50
292
 
51
293
  var reg$a = /^\d{6}$/;
52
294
  function isPostcode(value) {
53
- var valueStr = normalizeString(value);
295
+ var valueStr = toString(value);
54
296
  return reg$a.test(valueStr);
55
297
  }
56
298
 
@@ -71,7 +313,7 @@
71
313
  function isIdCard(value, options) {
72
314
  if (options === void 0) { options = {}; }
73
315
  var _a = options.loose, loose = _a === void 0 ? false : _a, _b = options.checkCode, checkCode = _b === void 0 ? true : _b;
74
- var valueStr = normalizeString(value);
316
+ var valueStr = toString(value);
75
317
  if (valueStr.length === 15 && loose) {
76
318
  return regIdCard$1.test(valueStr);
77
319
  }
@@ -86,25 +328,25 @@
86
328
 
87
329
  var reg$9 = /^[\da-z]+([-._]?[\da-z]+)*@[\da-z]+([-.]?[\da-z]+)*(\.[a-z]{2,})+$/i;
88
330
  function isEmail(value) {
89
- var valueStr = normalizeString(value);
331
+ var valueStr = toString(value);
90
332
  return reg$9.test(valueStr);
91
333
  }
92
334
 
93
335
  var reg$8 = /^[1-9]\d{4,10}$/;
94
336
  function isQQ(value) {
95
- var valueStr = normalizeString(value);
337
+ var valueStr = toString(value);
96
338
  return reg$8.test(valueStr);
97
339
  }
98
340
 
99
341
  var reg$7 = /^[a-z]([-_a-z0-9]{5,19})+$/i;
100
342
  function isWX(value) {
101
- var valueStr = normalizeString(value);
343
+ var valueStr = toString(value);
102
344
  return reg$7.test(valueStr);
103
345
  }
104
346
 
105
347
  var reg$6 = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}(([A-Z0-9]{4}[A-Z0-9挂学警港澳]{1})|([A-Z0-9]{5}[DF])|([DF][A-Z0-9]{5}))$/;
106
348
  function isVehicle(value) {
107
- var valueStr = normalizeString(value);
349
+ var valueStr = toString(value);
108
350
  return reg$6.test(valueStr);
109
351
  }
110
352
 
@@ -123,7 +365,7 @@
123
365
  function isBankCard(value, options) {
124
366
  if (options === void 0) { options = {}; }
125
367
  var _a = options.loose, loose = _a === void 0 ? false : _a, _b = options.luhn, luhn = _b === void 0 ? false : _b;
126
- var valueStr = normalizeString(value);
368
+ var valueStr = toString(value);
127
369
  var validateResult = loose ? regLoose.test(valueStr) : reg$5.test(valueStr);
128
370
  if (validateResult && luhn) {
129
371
  var precode = valueStr.substring(0, valueStr.length - 1);
@@ -151,7 +393,7 @@
151
393
  }
152
394
  function isSocialCreditCode(value, options) {
153
395
  if (options === void 0) { options = {}; }
154
- var valueStr = normalizeString(value);
396
+ var valueStr = toString(value);
155
397
  var _a = options.loose, loose = _a === void 0 ? false : _a, _b = options.checkCode, cc = _b === void 0 ? true : _b;
156
398
  var needCheckCode = !loose && cc;
157
399
  var passBaseRule = baseReg$1.test(valueStr);
@@ -164,118 +406,12 @@
164
406
  return lastCode === checkCode;
165
407
  }
166
408
 
167
- /******************************************************************************
168
- Copyright (c) Microsoft Corporation.
169
-
170
- Permission to use, copy, modify, and/or distribute this software for any
171
- purpose with or without fee is hereby granted.
172
-
173
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
174
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
175
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
176
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
177
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
178
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
179
- PERFORMANCE OF THIS SOFTWARE.
180
- ***************************************************************************** */
181
- /* global Reflect, Promise */
182
-
183
-
184
- var __assign = function() {
185
- __assign = Object.assign || function __assign(t) {
186
- for (var s, i = 1, n = arguments.length; i < n; i++) {
187
- s = arguments[i];
188
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
189
- }
190
- return t;
191
- };
192
- return __assign.apply(this, arguments);
193
- };
194
-
195
- function __awaiter(thisArg, _arguments, P, generator) {
196
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
197
- return new (P || (P = Promise))(function (resolve, reject) {
198
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
199
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
200
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
201
- step((generator = generator.apply(thisArg, _arguments || [])).next());
202
- });
203
- }
204
-
205
- function __generator(thisArg, body) {
206
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
207
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
208
- function verb(n) { return function (v) { return step([n, v]); }; }
209
- function step(op) {
210
- if (f) throw new TypeError("Generator is already executing.");
211
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
212
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
213
- if (y = 0, t) op = [op[0] & 2, t.value];
214
- switch (op[0]) {
215
- case 0: case 1: t = op; break;
216
- case 4: _.label++; return { value: op[1], done: false };
217
- case 5: _.label++; y = op[1]; op = [0]; continue;
218
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
219
- default:
220
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
221
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
222
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
223
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
224
- if (t[2]) _.ops.pop();
225
- _.trys.pop(); continue;
226
- }
227
- op = body.call(thisArg, _);
228
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
229
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
230
- }
231
- }
232
-
233
- function __values(o) {
234
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
235
- if (m) return m.call(o);
236
- if (o && typeof o.length === "number") return {
237
- next: function () {
238
- if (o && i >= o.length) o = void 0;
239
- return { value: o && o[i++], done: !o };
240
- }
241
- };
242
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
243
- }
244
-
245
- function __read(o, n) {
246
- var m = typeof Symbol === "function" && o[Symbol.iterator];
247
- if (!m) return o;
248
- var i = m.call(o), r, ar = [], e;
249
- try {
250
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
251
- }
252
- catch (error) { e = { error: error }; }
253
- finally {
254
- try {
255
- if (r && !r.done && (m = i["return"])) m.call(i);
256
- }
257
- finally { if (e) throw e.error; }
258
- }
259
- return ar;
260
- }
261
-
262
- function __spreadArray(to, from, pack) {
263
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
264
- if (ar || !(i in from)) {
265
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
266
- ar[i] = from[i];
267
- }
268
- }
269
- return to.concat(ar || Array.prototype.slice.call(from));
270
- }
271
-
272
409
  var config = {
273
410
  disableWarning: true
274
411
  };
275
412
  function setDisableWarning(bool) {
276
413
  config.disableWarning = !!bool;
277
414
  }
278
- var version = "4.17.3";
279
415
 
280
416
  function devWarn() {
281
417
  var args = [];
@@ -403,7 +539,7 @@
403
539
 
404
540
  var reg$4 = /^((e[\da-z])|(de)|(se)|(pe)|([khm][\da-z]))[\da-z]{7}$/i;
405
541
  function isPassport(value) {
406
- var valueStr = normalizeString(value);
542
+ var valueStr = toString(value);
407
543
  return reg$4.test(valueStr);
408
544
  }
409
545
 
@@ -426,7 +562,7 @@
426
562
  function isChinese(value, options) {
427
563
  if (options === void 0) { options = {}; }
428
564
  var _a = options.loose, loose = _a === void 0 ? false : _a, _b = options.useExtend, useExtend = _b === void 0 ? false : _b;
429
- var valueStr = normalizeString(value);
565
+ var valueStr = toString(value);
430
566
  var basicRegExp = loose ? looseChineseRegExp : chineseRegExp;
431
567
  var extendRegExp = loose ? looseChineseExtendRegExp : chineseExtendRegExp;
432
568
  var hasExtend = useExtend && supportRegExpUnicode;
@@ -438,13 +574,13 @@
438
574
 
439
575
  var reg$3 = /^((\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/;
440
576
  function isIPv4(value) {
441
- var valueStr = normalizeString(value);
577
+ var valueStr = toString(value);
442
578
  return reg$3.test(valueStr);
443
579
  }
444
580
 
445
581
  var reg$2 = /^((([0-9A-F]{1,4}:){7}([0-9A-F]{1,4}|:))|(([0-9A-F]{1,4}:){6}(:[0-9A-F]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|\d{1,2})(\.(25[0-5]|2[0-4]\d|1\d\d|\d{1,2})){3})|:))|(([0-9A-F]{1,4}:){5}(((:[0-9A-F]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|\d{1,2})(\.(25[0-5]|2[0-4]\d|1\d\d|\d{1,2})){3})|:))|(([0-9A-F]{1,4}:){4}(((:[0-9A-F]{1,4}){1,3})|((:[0-9A-F]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|\d{1,2})(\.(25[0-5]|2[0-4]\d|1\d\d|\d{1,2})){3}))|:))|(([0-9A-F]{1,4}:){3}(((:[0-9A-F]{1,4}){1,4})|((:[0-9A-F]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|\d{1,2})(\.(25[0-5]|2[0-4]\d|1\d\d|\d{1,2})){3}))|:))|(([0-9A-F]{1,4}:){2}(((:[0-9A-F]{1,4}){1,5})|((:[0-9A-F]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|\d{1,2})(\.(25[0-5]|2[0-4]\d|1\d\d|\d{1,2})){3}))|:))|(([0-9A-F]{1,4}:){1}(((:[0-9A-F]{1,4}){1,6})|((:[0-9A-F]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|\d{1,2})(\.(25[0-5]|2[0-4]\d|1\d\d|\d{1,2})){3}))|:))|(:(((:[0-9A-F]{1,4}){1,7})|((:[0-9A-F]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|\d{1,2})(\.(25[0-5]|2[0-4]\d|1\d\d|\d{1,2})){3}))|:)))(%.+)?$/i;
446
582
  function isIPv6(value) {
447
- var valueStr = normalizeString(value);
583
+ var valueStr = toString(value);
448
584
  return reg$2.test(valueStr);
449
585
  }
450
586
 
@@ -458,7 +594,7 @@
458
594
  var regWithProtocal = new RegExp("^".concat(protocalReg, "(?:").concat(credentialsReg, ")?(?:").concat(serverReg, ")(?:").concat(portReg, ")?(?:").concat(pathReg, ")*(?:").concat(searchReg, ")?(?:").concat(hashReg, ")?$"));
459
595
  var regNonProtocal = new RegExp("^(?:".concat(serverReg, ")(?:").concat(portReg, ")?(?:").concat(pathReg, ")*(?:").concat(searchReg, ")?(?:").concat(hashReg, ")?$"));
460
596
  function isUrl(value) {
461
- var valueStr = normalizeString(value);
597
+ var valueStr = toString(value);
462
598
  return regWithProtocal.test(valueStr) || regNonProtocal.test(valueStr);
463
599
  }
464
600
 
@@ -483,7 +619,7 @@
483
619
  }
484
620
  function isBusinessLicense(value, options) {
485
621
  if (options === void 0) { options = {}; }
486
- var valueStr = normalizeString(value);
622
+ var valueStr = toString(value);
487
623
  var _a = options.loose, loose = _a === void 0 ? false : _a, _b = options.checkCode, cc = _b === void 0 ? true : _b;
488
624
  var needCheckCode = !loose && cc;
489
625
  var passBaseRule = baseReg.test(valueStr);
@@ -497,12 +633,12 @@
497
633
  }
498
634
 
499
635
  function isPromiseLike(obj) {
500
- return obj !== null && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function';
636
+ return isPromiseLike$1(obj);
501
637
  }
502
638
 
503
639
  var regHMCard = /^[hm]{1}([0-9]{10}|[0-9]{8})$/i;
504
640
  function isHMCard(value) {
505
- var valueStr = normalizeString(value);
641
+ var valueStr = toString(value);
506
642
  return regHMCard.test(valueStr);
507
643
  }
508
644
 
@@ -511,7 +647,7 @@
511
647
  function isTWCard(value, options) {
512
648
  if (options === void 0) { options = {}; }
513
649
  var _a = options.loose, loose = _a === void 0 ? false : _a;
514
- var valueStr = normalizeString(value);
650
+ var valueStr = toString(value);
515
651
  if (regTWCard.test(valueStr)) {
516
652
  return true;
517
653
  }
@@ -520,31 +656,10 @@
520
656
 
521
657
  var reg$1 = /^[A-Z]{6}[A-Z\d]{2}(?:[A-Z\d]{3})?$/;
522
658
  function isSwiftCode(value) {
523
- var valueStr = normalizeString(value);
659
+ var valueStr = toString(value);
524
660
  return reg$1.test(valueStr);
525
661
  }
526
662
 
527
- function isBlob(value) {
528
- return isType(value, 'Blob');
529
- }
530
-
531
- function isObject(value) {
532
- var type = typeof value;
533
- return value != null && (type === 'object' || type === 'function');
534
- }
535
-
536
- function _isNaN(value) {
537
- return isType(value, 'Number') && isNaN(value);
538
- }
539
-
540
- function isNumber(value) {
541
- return isType(value, 'Number');
542
- }
543
-
544
- function isSymbol(value) {
545
- return isType(value, 'Symbol');
546
- }
547
-
548
663
  function isValidNumber(value, strict) {
549
664
  if (strict === void 0) { strict = false; }
550
665
  var ret;
@@ -565,9 +680,6 @@
565
680
  return typeof ret === 'number' && !Number.isNaN(ret);
566
681
  }
567
682
 
568
- var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
569
- var MIN_SAFE_INTEGER = Number.MIN_SAFE_INTEGER || -9007199254740991;
570
-
571
683
  function transformEffectiveNumber(value) {
572
684
  var ret;
573
685
  if (isString(value)) {
@@ -668,7 +780,7 @@
668
780
 
669
781
  var reg = /^[+-]?\d*\.?\d*$/;
670
782
  function checkNumber(num) {
671
- if ((typeof num !== 'number' && typeof num !== 'string') || (typeof num === 'number' && _isNaN(num)) || (typeof num === 'string' && (!(reg.test(num) || isScientificNumber(num)) || num === ''))) {
783
+ if ((typeof num !== 'number' && typeof num !== 'string') || (typeof num === 'number' && isNaN$1(num)) || (typeof num === 'string' && (!(reg.test(num) || isScientificNumber(num)) || num === ''))) {
672
784
  devWarn("".concat(num, " invalid parameter."));
673
785
  return false;
674
786
  }
@@ -712,7 +824,7 @@
712
824
  if (typeof num === 'number' && !isFinite(num)) {
713
825
  return num + '';
714
826
  }
715
- if (typeof precision !== 'number' || _isNaN(precision) || precision < 0) {
827
+ if (typeof precision !== 'number' || isNaN$1(precision) || precision < 0) {
716
828
  precision = 2;
717
829
  }
718
830
  else if (precision > 10) {
@@ -733,7 +845,7 @@
733
845
  var realSpaceMark = 'spaceMark' in options ? options.spaceMark : char;
734
846
  var reg = new RegExp("(.{".concat(length, "})"), 'g');
735
847
  var regChar = new RegExp("".concat(realSpaceMark), 'g');
736
- var realValue = normalizeString(bankCardNo).replace(regChar, '');
848
+ var realValue = toString(bankCardNo).replace(regChar, '');
737
849
  var str = realValue.replace(reg, "$1".concat(realSpaceMark));
738
850
  return realValue.length % length === 0 ? str.substring(0, str.length - 1) : str;
739
851
  }
@@ -742,7 +854,7 @@
742
854
  if (options === void 0) { options = {}; }
743
855
  var _a = options.char, char = _a === void 0 ? '*' : _a, exclude = options.exclude;
744
856
  var _b = options.start, start = _b === void 0 ? 3 : _b, _c = options.end, end = _c === void 0 ? -4 : _c, repeat = options.repeat;
745
- var realStr = normalizeString(str);
857
+ var realStr = toString(str);
746
858
  var strLen = realStr.length;
747
859
  if (Math.abs(start) >= strLen) {
748
860
  return realStr;
@@ -997,6 +1109,10 @@
997
1109
  return "data:".concat(mimeType).concat(base64 ? ';base64' : '', ",").concat(data);
998
1110
  }
999
1111
 
1112
+ function normalizeString(value) {
1113
+ return toString(value);
1114
+ }
1115
+
1000
1116
  function safeDate(value) {
1001
1117
  var args = [];
1002
1118
  for (var _i = 1; _i < arguments.length; _i++) {
@@ -1015,7 +1131,7 @@
1015
1131
  var _a = options.char, char = _a === void 0 ? ' ' : _a;
1016
1132
  var realSpaceMark = 'spaceMark' in options ? options.spaceMark : char;
1017
1133
  var regChar = new RegExp(realSpaceMark, 'g');
1018
- var realValue = normalizeString(mobileNo).replace(regChar, '').substring(0, 11);
1134
+ var realValue = toString(mobileNo).replace(regChar, '').substring(0, 11);
1019
1135
  if (realValue.length > 7) {
1020
1136
  return realValue.replace(/^(...)(....)/g, "$1".concat(realSpaceMark, "$2").concat(realSpaceMark));
1021
1137
  }
@@ -1027,7 +1143,7 @@
1027
1143
 
1028
1144
  function padZero(value, size) {
1029
1145
  if (size === void 0) { size = 2; }
1030
- var str = normalizeString(value);
1146
+ var str = toString(value);
1031
1147
  var len = str.length;
1032
1148
  if (typeof size !== 'number' || size < 0) {
1033
1149
  size = 0;
@@ -1049,7 +1165,7 @@
1049
1165
  }
1050
1166
  num1 = transformEffectiveNumber(num1);
1051
1167
  num2 = transformEffectiveNumber(num2);
1052
- if (_isNaN(num1) || _isNaN(num2)) {
1168
+ if (isNaN$1(num1) || isNaN$1(num2)) {
1053
1169
  return Number.NaN;
1054
1170
  }
1055
1171
  var num1Changed = float2Fixed(num1);
@@ -1071,7 +1187,7 @@
1071
1187
  }
1072
1188
  num1 = transformEffectiveNumber(num1);
1073
1189
  num2 = transformEffectiveNumber(num2);
1074
- if (_isNaN(num1) || _isNaN(num2)) {
1190
+ if (isNaN$1(num1) || isNaN$1(num2)) {
1075
1191
  return Number.NaN;
1076
1192
  }
1077
1193
  var baseNum = Math.pow(10, Math.max(digitLength(num1), digitLength(num2)));
@@ -1089,7 +1205,7 @@
1089
1205
  }
1090
1206
  num1 = transformEffectiveNumber(num1);
1091
1207
  num2 = transformEffectiveNumber(num2);
1092
- if (_isNaN(num1) || _isNaN(num2)) {
1208
+ if (isNaN$1(num1) || isNaN$1(num2)) {
1093
1209
  return Number.NaN;
1094
1210
  }
1095
1211
  var baseNum = Math.pow(10, Math.max(digitLength(num1), digitLength(num2)));
@@ -1107,7 +1223,7 @@
1107
1223
  }
1108
1224
  num1 = transformEffectiveNumber(num1);
1109
1225
  num2 = transformEffectiveNumber(num2);
1110
- if (_isNaN(num1) || _isNaN(num2)) {
1226
+ if (isNaN$1(num1) || isNaN$1(num2)) {
1111
1227
  return Number.NaN;
1112
1228
  }
1113
1229
  var num1Changed = float2Fixed(num1);
@@ -1120,7 +1236,7 @@
1120
1236
  function round(num, precision) {
1121
1237
  if (precision === void 0) { precision = 0; }
1122
1238
  num = transformEffectiveNumber(num);
1123
- if (_isNaN(num)) {
1239
+ if (isNaN$1(num)) {
1124
1240
  return Number.NaN;
1125
1241
  }
1126
1242
  var base = Math.pow(10, precision);
@@ -1182,8 +1298,8 @@
1182
1298
  function calculateCursorPosition(prevPos, prevCtrlValue, rawValue, ctrlValue, options) {
1183
1299
  if (options === void 0) { options = {}; }
1184
1300
  var _a = options.placeholderChar, placeholderChar = _a === void 0 ? ' ' : _a, _b = options.maskReg, maskReg = _b === void 0 ? /\D/g : _b, type = options.type;
1185
- var realCtrlValue = normalizeString(prevCtrlValue);
1186
- var realRawValue = normalizeString(rawValue);
1301
+ var realCtrlValue = toString(prevCtrlValue);
1302
+ var realRawValue = toString(rawValue);
1187
1303
  var placeholderChars = Array.isArray(placeholderChar) ? placeholderChar : [placeholderChar];
1188
1304
  var editLength = realRawValue.length - realCtrlValue.length;
1189
1305
  var isAddition = editLength > 0;
@@ -1247,11 +1363,11 @@
1247
1363
  if (!(dataType === 'url' || (!dataType && isUrl(data)))) return [3, 6];
1248
1364
  asyncTransformRequest = function (opts) {
1249
1365
  var tempOptions = typeof transformRequest === 'function' ? transformRequest(opts) : opts;
1250
- return isPromiseLike(tempOptions) ? tempOptions : Promise.resolve(tempOptions);
1366
+ return isPromiseLike$1(tempOptions) ? tempOptions : Promise.resolve(tempOptions);
1251
1367
  };
1252
1368
  asyncTransformResponse = function (res) {
1253
1369
  var tempRes = typeof transformResponse === 'function' ? transformResponse(res) : res;
1254
- return isPromiseLike(tempRes) ? tempRes : Promise.resolve(tempRes);
1370
+ return isPromiseLike$1(tempRes) ? tempRes : Promise.resolve(tempRes);
1255
1371
  };
1256
1372
  return [4, asyncTransformRequest({ responseType: 'blob' })];
1257
1373
  case 3:
@@ -1309,7 +1425,7 @@
1309
1425
  }
1310
1426
 
1311
1427
  function strlen(str) {
1312
- var realStr = normalizeString(str);
1428
+ var realStr = toString(str);
1313
1429
  var len = 0;
1314
1430
  for (var i = 0; i < realStr.length; i++) {
1315
1431
  var c = realStr.charCodeAt(i);
@@ -1325,9 +1441,7 @@
1325
1441
 
1326
1442
  function waitTime(time) {
1327
1443
  if (time === void 0) { time = 1000; }
1328
- return new Promise(function (resolve) {
1329
- setTimeout(resolve, time);
1330
- });
1444
+ return sleep(time);
1331
1445
  }
1332
1446
 
1333
1447
  function transformFieldNames(data, fieldNames, childrenField, nodeAssign) {
@@ -1586,6 +1700,11 @@
1586
1700
  return internalFindTreeSelect(tree, predicate, childrenField);
1587
1701
  }
1588
1702
 
1703
+ var VERSION = "4.18.0";
1704
+
1705
+ var version = "4.18.0";
1706
+
1707
+ exports.VERSION = VERSION;
1589
1708
  exports.ajax = ajax;
1590
1709
  exports.blobToDataURL = blobToDataURL;
1591
1710
  exports.bytesToSize = bytesToSize;