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
package/esm/VERSION.js ADDED
@@ -0,0 +1,4 @@
1
+ var VERSION = "4.18.0";
2
+ var VERSION$1 = VERSION;
3
+
4
+ export { VERSION$1 as default };
@@ -1,10 +1,10 @@
1
- import normalizeString from './normalizeString.js';
1
+ import { toString } from 'ut2';
2
2
 
3
3
  function calculateCursorPosition(prevPos, prevCtrlValue, rawValue, ctrlValue, options) {
4
4
  if (options === void 0) { options = {}; }
5
5
  var _a = options.placeholderChar, placeholderChar = _a === void 0 ? ' ' : _a, _b = options.maskReg, maskReg = _b === void 0 ? /\D/g : _b, type = options.type;
6
- var realCtrlValue = normalizeString(prevCtrlValue);
7
- var realRawValue = normalizeString(rawValue);
6
+ var realCtrlValue = toString(prevCtrlValue);
7
+ var realRawValue = toString(rawValue);
8
8
  var placeholderChars = Array.isArray(placeholderChar) ? placeholderChar : [placeholderChar];
9
9
  var editLength = realRawValue.length - realCtrlValue.length;
10
10
  var isAddition = editLength > 0;
package/esm/divide.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { __read, __spreadArray } from 'tslib';
2
+ import { isNaN } from 'ut2';
2
3
  import { transformEffectiveNumber, float2Fixed, checkBoundary, strip, digitLength } from './utils/math.util.js';
3
4
  import times from './times.js';
4
- import _isNaN from './utils/type/isNaN.js';
5
5
 
6
6
  function divide() {
7
7
  var nums = [];
@@ -14,7 +14,7 @@ function divide() {
14
14
  }
15
15
  num1 = transformEffectiveNumber(num1);
16
16
  num2 = transformEffectiveNumber(num2);
17
- if (_isNaN(num1) || _isNaN(num2)) {
17
+ if (isNaN(num1) || isNaN(num2)) {
18
18
  return Number.NaN;
19
19
  }
20
20
  var num1Changed = float2Fixed(num1);
package/esm/download.js CHANGED
@@ -1,9 +1,8 @@
1
1
  import { __awaiter, __generator } from 'tslib';
2
+ import { isBlob, isPromiseLike } from 'ut2';
2
3
  import dataURLToBlob from './dataURLToBlob.js';
3
4
  import isUrl from './isUrl.js';
4
5
  import ajax from './ajax.js';
5
- import isBlob from './utils/type/isBlob.js';
6
- import isPromiseLike from './isPromiseLike.js';
7
6
 
8
7
  function saver(blobUrl, fileName) {
9
8
  if (fileName === void 0) { fileName = ''; }
package/esm/filterTree.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { __assign } from 'tslib';
2
- import isObject from './utils/type/isObject.js';
2
+ import { isObject } from 'ut2';
3
3
 
4
4
  function filterTree(tree, predicate, childrenField, nodeAssign) {
5
5
  if (childrenField === void 0) { childrenField = 'children'; }
@@ -1,5 +1,5 @@
1
1
  import { __values, __spreadArray, __read } from 'tslib';
2
- import isObject from './utils/type/isObject.js';
2
+ import { isObject } from 'ut2';
3
3
 
4
4
  function findTreeNode(tree, predicate, childrenField) {
5
5
  var e_1, _a;
@@ -1,5 +1,5 @@
1
1
  import { __values, __spreadArray, __read } from 'tslib';
2
- import isObject from './utils/type/isObject.js';
2
+ import { isObject } from 'ut2';
3
3
 
4
4
  function findTreeNodes(tree, predicate, childrenField) {
5
5
  var e_1, _a;
@@ -1,5 +1,5 @@
1
1
  import { __values } from 'tslib';
2
- import isObject from './utils/type/isObject.js';
2
+ import { isObject } from 'ut2';
3
3
 
4
4
  function internalFindTreeSelect(tree, predicate, childrenField, path) {
5
5
  var e_1, _a;
@@ -1,4 +1,4 @@
1
- import normalizeString from './normalizeString.js';
1
+ import { toString } from 'ut2';
2
2
 
3
3
  function formatBankCard(bankCardNo, options) {
4
4
  if (bankCardNo === void 0) { bankCardNo = ''; }
@@ -7,7 +7,7 @@ function formatBankCard(bankCardNo, options) {
7
7
  var realSpaceMark = 'spaceMark' in options ? options.spaceMark : char;
8
8
  var reg = new RegExp("(.{".concat(length, "})"), 'g');
9
9
  var regChar = new RegExp("".concat(realSpaceMark), 'g');
10
- var realValue = normalizeString(bankCardNo).replace(regChar, '');
10
+ var realValue = toString(bankCardNo).replace(regChar, '');
11
11
  var str = realValue.replace(reg, "$1".concat(realSpaceMark));
12
12
  return realValue.length % length === 0 ? str.substring(0, str.length - 1) : str;
13
13
  }
@@ -1,4 +1,4 @@
1
- import normalizeString from './normalizeString.js';
1
+ import { toString } from 'ut2';
2
2
 
3
3
  function formatMobile(mobileNo, options) {
4
4
  if (mobileNo === void 0) { mobileNo = ''; }
@@ -6,7 +6,7 @@ function formatMobile(mobileNo, options) {
6
6
  var _a = options.char, char = _a === void 0 ? ' ' : _a;
7
7
  var realSpaceMark = 'spaceMark' in options ? options.spaceMark : char;
8
8
  var regChar = new RegExp(realSpaceMark, 'g');
9
- var realValue = normalizeString(mobileNo).replace(regChar, '').substring(0, 11);
9
+ var realValue = toString(mobileNo).replace(regChar, '').substring(0, 11);
10
10
  if (realValue.length > 7) {
11
11
  return realValue.replace(/^(...)(....)/g, "$1".concat(realSpaceMark, "$2").concat(realSpaceMark));
12
12
  }
@@ -1,11 +1,11 @@
1
1
  import { __read } from 'tslib';
2
+ import { isNaN } from 'ut2';
2
3
  import { scientificToNumber, isScientificNumber, checkBoundary, trimLeftZero } from './utils/math.util.js';
3
- import _isNaN from './utils/type/isNaN.js';
4
4
  import devWarn from './utils/devWarn.js';
5
5
 
6
6
  var reg = /^[+-]?\d*\.?\d*$/;
7
7
  function checkNumber(num) {
8
- if ((typeof num !== 'number' && typeof num !== 'string') || (typeof num === 'number' && _isNaN(num)) || (typeof num === 'string' && (!(reg.test(num) || isScientificNumber(num)) || num === ''))) {
8
+ if ((typeof num !== 'number' && typeof num !== 'string') || (typeof num === 'number' && isNaN(num)) || (typeof num === 'string' && (!(reg.test(num) || isScientificNumber(num)) || num === ''))) {
9
9
  devWarn("".concat(num, " invalid parameter."));
10
10
  return false;
11
11
  }
@@ -49,7 +49,7 @@ var formatMoney = function (num, options) {
49
49
  if (typeof num === 'number' && !isFinite(num)) {
50
50
  return num + '';
51
51
  }
52
- if (typeof precision !== 'number' || _isNaN(precision) || precision < 0) {
52
+ if (typeof precision !== 'number' || isNaN(precision) || precision < 0) {
53
53
  precision = 2;
54
54
  }
55
55
  else if (precision > 10) {
package/esm/index.js CHANGED
@@ -53,4 +53,9 @@ export { default as filterTree } from './filterTree.js';
53
53
  export { default as findTreeNode } from './findTreeNode.js';
54
54
  export { default as findTreeNodes } from './findTreeNodes.js';
55
55
  export { default as findTreeSelect } from './findTreeSelect.js';
56
- export { setDisableWarning, version } from './utils/config.js';
56
+ export { setDisableWarning } from './utils/config.js';
57
+ export { default as VERSION } from './VERSION.js';
58
+
59
+ var version = "4.18.0";
60
+
61
+ export { version };
package/esm/isBankCard.js CHANGED
@@ -1,4 +1,4 @@
1
- import normalizeString from './normalizeString.js';
1
+ import { toString } from 'ut2';
2
2
 
3
3
  var reg = /^[1-9]\d{9,20}$/;
4
4
  var regLoose = /^\d{8,30}$/;
@@ -15,7 +15,7 @@ function sumCheckCode(numStr) {
15
15
  function isBankCard(value, options) {
16
16
  if (options === void 0) { options = {}; }
17
17
  var _a = options.loose, loose = _a === void 0 ? false : _a, _b = options.luhn, luhn = _b === void 0 ? false : _b;
18
- var valueStr = normalizeString(value);
18
+ var valueStr = toString(value);
19
19
  var validateResult = loose ? regLoose.test(valueStr) : reg.test(valueStr);
20
20
  if (validateResult && luhn) {
21
21
  var precode = valueStr.substring(0, valueStr.length - 1);
@@ -1,4 +1,4 @@
1
- import normalizeString from './normalizeString.js';
1
+ import { toString } from 'ut2';
2
2
 
3
3
  var baseReg = /^\d{15}$/;
4
4
  function sumCheckCode(preCode) {
@@ -21,7 +21,7 @@ function sumCheckCode(preCode) {
21
21
  }
22
22
  function isBusinessLicense(value, options) {
23
23
  if (options === void 0) { options = {}; }
24
- var valueStr = normalizeString(value);
24
+ var valueStr = toString(value);
25
25
  var _a = options.loose, loose = _a === void 0 ? false : _a, _b = options.checkCode, cc = _b === void 0 ? true : _b;
26
26
  var needCheckCode = !loose && cc;
27
27
  var passBaseRule = baseReg.test(valueStr);
package/esm/isChinese.js CHANGED
@@ -1,4 +1,4 @@
1
- import normalizeString from './normalizeString.js';
1
+ import { toString } from 'ut2';
2
2
 
3
3
  var chineseDictionary = {
4
4
  chineseBasic: '[\u4e00-\u9fa5]',
@@ -19,7 +19,7 @@ var supportRegExpUnicode = RegExp.prototype.hasOwnProperty('unicode');
19
19
  function isChinese(value, options) {
20
20
  if (options === void 0) { options = {}; }
21
21
  var _a = options.loose, loose = _a === void 0 ? false : _a, _b = options.useExtend, useExtend = _b === void 0 ? false : _b;
22
- var valueStr = normalizeString(value);
22
+ var valueStr = toString(value);
23
23
  var basicRegExp = loose ? looseChineseRegExp : chineseRegExp;
24
24
  var extendRegExp = loose ? looseChineseExtendRegExp : chineseExtendRegExp;
25
25
  var hasExtend = useExtend && supportRegExpUnicode;
package/esm/isEmail.js CHANGED
@@ -1,8 +1,8 @@
1
- import normalizeString from './normalizeString.js';
1
+ import { toString } from 'ut2';
2
2
 
3
3
  var reg = /^[\da-z]+([-._]?[\da-z]+)*@[\da-z]+([-.]?[\da-z]+)*(\.[a-z]{2,})+$/i;
4
4
  function isEmail(value) {
5
- var valueStr = normalizeString(value);
5
+ var valueStr = toString(value);
6
6
  return reg.test(valueStr);
7
7
  }
8
8
 
package/esm/isHMCard.js CHANGED
@@ -1,8 +1,8 @@
1
- import normalizeString from './normalizeString.js';
1
+ import { toString } from 'ut2';
2
2
 
3
3
  var regHMCard = /^[hm]{1}([0-9]{10}|[0-9]{8})$/i;
4
4
  function isHMCard(value) {
5
- var valueStr = normalizeString(value);
5
+ var valueStr = toString(value);
6
6
  return regHMCard.test(valueStr);
7
7
  }
8
8
 
package/esm/isIPv4.js CHANGED
@@ -1,8 +1,8 @@
1
- import normalizeString from './normalizeString.js';
1
+ import { toString } from 'ut2';
2
2
 
3
3
  var reg = /^((\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])$/;
4
4
  function isIPv4(value) {
5
- var valueStr = normalizeString(value);
5
+ var valueStr = toString(value);
6
6
  return reg.test(valueStr);
7
7
  }
8
8
 
package/esm/isIPv6.js CHANGED
@@ -1,8 +1,8 @@
1
- import normalizeString from './normalizeString.js';
1
+ import { toString } from 'ut2';
2
2
 
3
3
  var reg = /^((([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;
4
4
  function isIPv6(value) {
5
- var valueStr = normalizeString(value);
5
+ var valueStr = toString(value);
6
6
  return reg.test(valueStr);
7
7
  }
8
8
 
package/esm/isIdCard.js CHANGED
@@ -1,4 +1,4 @@
1
- import normalizeString from './normalizeString.js';
1
+ import { toString } from 'ut2';
2
2
 
3
3
  var regIdCard = /^[1-9]\d{5}(19|20)?\d{2}((0[1-9])|(1[012]))(([0-2][1-9])|10|20|30|31)\d{3}(\d|X)?$/i;
4
4
  function check(id) {
@@ -17,7 +17,7 @@ function check(id) {
17
17
  function isIdCard(value, options) {
18
18
  if (options === void 0) { options = {}; }
19
19
  var _a = options.loose, loose = _a === void 0 ? false : _a, _b = options.checkCode, checkCode = _b === void 0 ? true : _b;
20
- var valueStr = normalizeString(value);
20
+ var valueStr = toString(value);
21
21
  if (valueStr.length === 15 && loose) {
22
22
  return regIdCard.test(valueStr);
23
23
  }
package/esm/isMobile.js CHANGED
@@ -1,8 +1,8 @@
1
- import normalizeString from './normalizeString.js';
1
+ import { toString } from 'ut2';
2
2
 
3
3
  var reg = /^1[3456789]\d{9}$/;
4
4
  function isMobile(value) {
5
- var valueStr = normalizeString(value);
5
+ var valueStr = toString(value);
6
6
  return reg.test(valueStr);
7
7
  }
8
8
 
package/esm/isPassport.js CHANGED
@@ -1,8 +1,8 @@
1
- import normalizeString from './normalizeString.js';
1
+ import { toString } from 'ut2';
2
2
 
3
3
  var reg = /^((e[\da-z])|(de)|(se)|(pe)|([khm][\da-z]))[\da-z]{7}$/i;
4
4
  function isPassport(value) {
5
- var valueStr = normalizeString(value);
5
+ var valueStr = toString(value);
6
6
  return reg.test(valueStr);
7
7
  }
8
8
 
package/esm/isPostcode.js CHANGED
@@ -1,8 +1,8 @@
1
- import normalizeString from './normalizeString.js';
1
+ import { toString } from 'ut2';
2
2
 
3
3
  var reg = /^\d{6}$/;
4
4
  function isPostcode(value) {
5
- var valueStr = normalizeString(value);
5
+ var valueStr = toString(value);
6
6
  return reg.test(valueStr);
7
7
  }
8
8
 
@@ -1,5 +1,7 @@
1
+ import { isPromiseLike as isPromiseLike$1 } from 'ut2';
2
+
1
3
  function isPromiseLike(obj) {
2
- return obj !== null && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function';
4
+ return isPromiseLike$1(obj);
3
5
  }
4
6
 
5
7
  export { isPromiseLike as default };
package/esm/isQQ.js CHANGED
@@ -1,8 +1,8 @@
1
- import normalizeString from './normalizeString.js';
1
+ import { toString } from 'ut2';
2
2
 
3
3
  var reg = /^[1-9]\d{4,10}$/;
4
4
  function isQQ(value) {
5
- var valueStr = normalizeString(value);
5
+ var valueStr = toString(value);
6
6
  return reg.test(valueStr);
7
7
  }
8
8
 
@@ -1,4 +1,4 @@
1
- import normalizeString from './normalizeString.js';
1
+ import { toString } from 'ut2';
2
2
 
3
3
  var baseReg = /^[\dA-HJ-NPQRTUWXY]{2}\d{6}[\dA-HJ-NPQRTUWXY]{10}$/;
4
4
  var baseCodeArr = '0123456789ABCDEFGHJKLMNPQRTUWXY'.split('');
@@ -18,7 +18,7 @@ function sumCheckCode(preCode) {
18
18
  }
19
19
  function isSocialCreditCode(value, options) {
20
20
  if (options === void 0) { options = {}; }
21
- var valueStr = normalizeString(value);
21
+ var valueStr = toString(value);
22
22
  var _a = options.loose, loose = _a === void 0 ? false : _a, _b = options.checkCode, cc = _b === void 0 ? true : _b;
23
23
  var needCheckCode = !loose && cc;
24
24
  var passBaseRule = baseReg.test(valueStr);
@@ -1,8 +1,8 @@
1
- import normalizeString from './normalizeString.js';
1
+ import { toString } from 'ut2';
2
2
 
3
3
  var reg = /^[A-Z]{6}[A-Z\d]{2}(?:[A-Z\d]{3})?$/;
4
4
  function isSwiftCode(value) {
5
- var valueStr = normalizeString(value);
5
+ var valueStr = toString(value);
6
6
  return reg.test(valueStr);
7
7
  }
8
8
 
package/esm/isTWCard.js CHANGED
@@ -1,11 +1,11 @@
1
- import normalizeString from './normalizeString.js';
1
+ import { toString } from 'ut2';
2
2
 
3
3
  var regTWCard = /^\d{8}$/i;
4
4
  var singleRegTWCard = /^[\da-z]{10,12}$/i;
5
5
  function isTWCard(value, options) {
6
6
  if (options === void 0) { options = {}; }
7
7
  var _a = options.loose, loose = _a === void 0 ? false : _a;
8
- var valueStr = normalizeString(value);
8
+ var valueStr = toString(value);
9
9
  if (regTWCard.test(valueStr)) {
10
10
  return true;
11
11
  }
@@ -1,8 +1,8 @@
1
- import normalizeString from './normalizeString.js';
1
+ import { toString } from 'ut2';
2
2
 
3
3
  var reg = /^(0\d{2,3}-)?([2-9]\d{6,7})(-\d{1,6})?$/;
4
4
  function isTelephone(value) {
5
- var valueStr = normalizeString(value);
5
+ var valueStr = toString(value);
6
6
  return reg.test(valueStr);
7
7
  }
8
8
 
package/esm/isUrl.js CHANGED
@@ -1,4 +1,4 @@
1
- import normalizeString from './normalizeString.js';
1
+ import { toString } from 'ut2';
2
2
 
3
3
  var protocalReg = '[\\w-.]+:\\/\\/';
4
4
  var credentialsReg = '[-;:&=\\+\\$,\\w]+@';
@@ -10,7 +10,7 @@ var hashReg = '#.*';
10
10
  var regWithProtocal = new RegExp("^".concat(protocalReg, "(?:").concat(credentialsReg, ")?(?:").concat(serverReg, ")(?:").concat(portReg, ")?(?:").concat(pathReg, ")*(?:").concat(searchReg, ")?(?:").concat(hashReg, ")?$"));
11
11
  var regNonProtocal = new RegExp("^(?:".concat(serverReg, ")(?:").concat(portReg, ")?(?:").concat(pathReg, ")*(?:").concat(searchReg, ")?(?:").concat(hashReg, ")?$"));
12
12
  function isUrl(value) {
13
- var valueStr = normalizeString(value);
13
+ var valueStr = toString(value);
14
14
  return regWithProtocal.test(valueStr) || regNonProtocal.test(valueStr);
15
15
  }
16
16
 
@@ -1,4 +1,4 @@
1
- import isSymbol from './utils/type/isSymbol.js';
1
+ import { isSymbol } from 'ut2';
2
2
 
3
3
  function isValidNumber(value, strict) {
4
4
  if (strict === void 0) { strict = false; }
package/esm/isVehicle.js CHANGED
@@ -1,8 +1,8 @@
1
- import normalizeString from './normalizeString.js';
1
+ import { toString } from 'ut2';
2
2
 
3
3
  var reg = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}(([A-Z0-9]{4}[A-Z0-9挂学警港澳]{1})|([A-Z0-9]{5}[DF])|([DF][A-Z0-9]{5}))$/;
4
4
  function isVehicle(value) {
5
- var valueStr = normalizeString(value);
5
+ var valueStr = toString(value);
6
6
  return reg.test(valueStr);
7
7
  }
8
8
 
package/esm/isWX.js CHANGED
@@ -1,8 +1,8 @@
1
- import normalizeString from './normalizeString.js';
1
+ import { toString } from 'ut2';
2
2
 
3
3
  var reg = /^[a-z]([-_a-z0-9]{5,19})+$/i;
4
4
  function isWX(value) {
5
- var valueStr = normalizeString(value);
5
+ var valueStr = toString(value);
6
6
  return reg.test(valueStr);
7
7
  }
8
8
 
package/esm/listToTree.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { __assign } from 'tslib';
2
- import isObject from './utils/type/isObject.js';
2
+ import { isObject } from 'ut2';
3
3
 
4
4
  function processEmptyChildren(arr, options) {
5
5
  var _a = options.childrenField, childrenField = _a === void 0 ? 'children' : _a, _b = options.emptyChildrenValue, emptyChildrenValue = _b === void 0 ? 'none' : _b;
package/esm/minus.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { __read, __spreadArray } from 'tslib';
2
+ import { isNaN } from 'ut2';
2
3
  import { transformEffectiveNumber, digitLength } from './utils/math.util.js';
3
4
  import times from './times.js';
4
- import _isNaN from './utils/type/isNaN.js';
5
5
 
6
6
  function minus() {
7
7
  var nums = [];
@@ -14,7 +14,7 @@ function minus() {
14
14
  }
15
15
  num1 = transformEffectiveNumber(num1);
16
16
  num2 = transformEffectiveNumber(num2);
17
- if (_isNaN(num1) || _isNaN(num2)) {
17
+ if (isNaN(num1) || isNaN(num2)) {
18
18
  return Number.NaN;
19
19
  }
20
20
  var baseNum = Math.pow(10, Math.max(digitLength(num1), digitLength(num2)));
@@ -1,11 +1,7 @@
1
- import isNil from './utils/type/isNil.js';
2
- import convertToString from './utils/convertToString.js';
1
+ import { toString } from 'ut2';
3
2
 
4
3
  function normalizeString(value) {
5
- if (isNil(value)) {
6
- return '';
7
- }
8
- return convertToString(value);
4
+ return toString(value);
9
5
  }
10
6
 
11
7
  export { normalizeString as default };
package/esm/padZero.js CHANGED
@@ -1,8 +1,8 @@
1
- import normalizeString from './normalizeString.js';
1
+ import { toString } from 'ut2';
2
2
 
3
3
  function padZero(value, size) {
4
4
  if (size === void 0) { size = 2; }
5
- var str = normalizeString(value);
5
+ var str = toString(value);
6
6
  var len = str.length;
7
7
  if (typeof size !== 'number' || size < 0) {
8
8
  size = 0;
package/esm/plus.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { __read, __spreadArray } from 'tslib';
2
+ import { isNaN } from 'ut2';
2
3
  import { transformEffectiveNumber, digitLength } from './utils/math.util.js';
3
4
  import times from './times.js';
4
- import _isNaN from './utils/type/isNaN.js';
5
5
 
6
6
  function plus() {
7
7
  var nums = [];
@@ -14,7 +14,7 @@ function plus() {
14
14
  }
15
15
  num1 = transformEffectiveNumber(num1);
16
16
  num2 = transformEffectiveNumber(num2);
17
- if (_isNaN(num1) || _isNaN(num2)) {
17
+ if (isNaN(num1) || isNaN(num2)) {
18
18
  return Number.NaN;
19
19
  }
20
20
  var baseNum = Math.pow(10, Math.max(digitLength(num1), digitLength(num2)));
@@ -1,10 +1,10 @@
1
- import normalizeString from './normalizeString.js';
1
+ import { toString } from 'ut2';
2
2
 
3
3
  function replaceChar(str, options) {
4
4
  if (options === void 0) { options = {}; }
5
5
  var _a = options.char, char = _a === void 0 ? '*' : _a, exclude = options.exclude;
6
6
  var _b = options.start, start = _b === void 0 ? 3 : _b, _c = options.end, end = _c === void 0 ? -4 : _c, repeat = options.repeat;
7
- var realStr = normalizeString(str);
7
+ var realStr = toString(str);
8
8
  var strLen = realStr.length;
9
9
  if (Math.abs(start) >= strLen) {
10
10
  return realStr;
package/esm/round.js CHANGED
@@ -1,12 +1,12 @@
1
+ import { isNaN } from 'ut2';
1
2
  import divide from './divide.js';
2
3
  import times from './times.js';
3
4
  import { transformEffectiveNumber } from './utils/math.util.js';
4
- import _isNaN from './utils/type/isNaN.js';
5
5
 
6
6
  function round(num, precision) {
7
7
  if (precision === void 0) { precision = 0; }
8
8
  num = transformEffectiveNumber(num);
9
- if (_isNaN(num)) {
9
+ if (isNaN(num)) {
10
10
  return Number.NaN;
11
11
  }
12
12
  var base = Math.pow(10, precision);
package/esm/strlen.js CHANGED
@@ -1,7 +1,7 @@
1
- import normalizeString from './normalizeString.js';
1
+ import { toString } from 'ut2';
2
2
 
3
3
  function strlen(str) {
4
- var realStr = normalizeString(str);
4
+ var realStr = toString(str);
5
5
  var len = 0;
6
6
  for (var i = 0; i < realStr.length; i++) {
7
7
  var c = realStr.charCodeAt(i);
package/esm/times.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { __read, __spreadArray } from 'tslib';
2
+ import { isNaN } from 'ut2';
2
3
  import { transformEffectiveNumber, float2Fixed, digitLength, checkBoundary } from './utils/math.util.js';
3
- import _isNaN from './utils/type/isNaN.js';
4
4
 
5
5
  function times() {
6
6
  var nums = [];
@@ -13,7 +13,7 @@ function times() {
13
13
  }
14
14
  num1 = transformEffectiveNumber(num1);
15
15
  num2 = transformEffectiveNumber(num2);
16
- if (_isNaN(num1) || _isNaN(num2)) {
16
+ if (isNaN(num1) || isNaN(num2)) {
17
17
  return Number.NaN;
18
18
  }
19
19
  var num1Changed = float2Fixed(num1);
@@ -1,5 +1,5 @@
1
1
  import { __assign } from 'tslib';
2
- import isObject from './utils/type/isObject.js';
2
+ import { isObject } from 'ut2';
3
3
 
4
4
  function transformFieldNames(data, fieldNames, childrenField, nodeAssign) {
5
5
  if (nodeAssign === void 0) { nodeAssign = 'spread'; }
package/esm/treeToList.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { __assign } from 'tslib';
2
- import isObject from './utils/type/isObject.js';
2
+ import { isObject } from 'ut2';
3
3
 
4
4
  function treeToList(tree, childrenField) {
5
5
  var list = [];
@@ -4,6 +4,5 @@ var config = {
4
4
  function setDisableWarning(bool) {
5
5
  config.disableWarning = !!bool;
6
6
  }
7
- var version = "4.17.3";
8
7
 
9
- export { config, setDisableWarning, version };
8
+ export { config, setDisableWarning };
@@ -1,8 +1,5 @@
1
- import { MAX_SAFE_INTEGER, MIN_SAFE_INTEGER } from './constants.js';
1
+ import { isString, isSymbol, isNumber, MAX_SAFE_INTEGER, MIN_SAFE_INTEGER } from 'ut2';
2
2
  import devWarn from './devWarn.js';
3
- import isNumber from './type/isNumber.js';
4
- import isString from './type/isString.js';
5
- import isSymbol from './type/isSymbol.js';
6
3
 
7
4
  function transformEffectiveNumber(value) {
8
5
  var ret;
package/esm/waitTime.js CHANGED
@@ -1,8 +1,8 @@
1
+ import { sleep } from 'ut2';
2
+
1
3
  function waitTime(time) {
2
4
  if (time === void 0) { time = 1000; }
3
- return new Promise(function (resolve) {
4
- setTimeout(resolve, time);
5
- });
5
+ return sleep(time);
6
6
  }
7
7
 
8
8
  export { waitTime as default };
package/lib/VERSION.js ADDED
@@ -0,0 +1,6 @@
1
+ 'use strict';
2
+
3
+ var VERSION = "4.18.0";
4
+ var VERSION$1 = VERSION;
5
+
6
+ module.exports = VERSION$1;
@@ -1,12 +1,12 @@
1
1
  'use strict';
2
2
 
3
- var normalizeString = require('./normalizeString.js');
3
+ var ut2 = require('ut2');
4
4
 
5
5
  function calculateCursorPosition(prevPos, prevCtrlValue, rawValue, ctrlValue, options) {
6
6
  if (options === void 0) { options = {}; }
7
7
  var _a = options.placeholderChar, placeholderChar = _a === void 0 ? ' ' : _a, _b = options.maskReg, maskReg = _b === void 0 ? /\D/g : _b, type = options.type;
8
- var realCtrlValue = normalizeString(prevCtrlValue);
9
- var realRawValue = normalizeString(rawValue);
8
+ var realCtrlValue = ut2.toString(prevCtrlValue);
9
+ var realRawValue = ut2.toString(rawValue);
10
10
  var placeholderChars = Array.isArray(placeholderChar) ? placeholderChar : [placeholderChar];
11
11
  var editLength = realRawValue.length - realCtrlValue.length;
12
12
  var isAddition = editLength > 0;