util-helpers 4.12.6 → 4.12.8

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 (204) hide show
  1. package/README.md +8 -4
  2. package/dist/util-helpers.js +217 -342
  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/bytesToSize.js +5 -11
  7. package/esm/calculateCursorPosition.js +1 -1
  8. package/esm/dataURLToBlob.js +1 -1
  9. package/esm/divide.js +1 -0
  10. package/esm/formatBankCard.js +4 -8
  11. package/esm/formatMobile.js +9 -7
  12. package/esm/formatMoney.js +8 -14
  13. package/esm/isBankCard.js +6 -11
  14. package/esm/isBusinessLicense.js +7 -10
  15. package/esm/isChinese.js +10 -17
  16. package/esm/isEmail.js +2 -5
  17. package/esm/isHMCard.js +8 -8
  18. package/esm/isIPv4.js +4 -11
  19. package/esm/isIPv6.js +11 -29
  20. package/esm/isIdCard.js +9 -12
  21. package/esm/isMobile.js +2 -5
  22. package/esm/isPassport.js +2 -5
  23. package/esm/isPassword.js +14 -21
  24. package/esm/isPostcode.js +2 -5
  25. package/esm/isPromiseLike.js +4 -8
  26. package/esm/isQQ.js +2 -5
  27. package/esm/isSocialCreditCode.js +6 -11
  28. package/esm/isSwiftCode.js +5 -5
  29. package/esm/isTWCard.js +7 -4
  30. package/esm/isTelephone.js +7 -10
  31. package/esm/isUrl.js +8 -20
  32. package/esm/isVehicle.js +9 -14
  33. package/esm/isWX.js +2 -5
  34. package/esm/minus.js +4 -8
  35. package/esm/normalizeString.js +2 -0
  36. package/esm/numberToChinese.js +13 -19
  37. package/esm/padZero.js +9 -8
  38. package/esm/parseIdCard.js +3 -3
  39. package/esm/plus.js +4 -8
  40. package/esm/randomString.js +2 -0
  41. package/esm/replaceChar.js +9 -17
  42. package/esm/round.js +4 -8
  43. package/esm/safeDate.js +2 -0
  44. package/esm/setDataURLPrefix.js +2 -0
  45. package/esm/times.js +4 -8
  46. package/esm/utils/config.js +2 -1
  47. package/esm/waitTime.js +3 -1
  48. package/lib/bytesToSize.js +5 -11
  49. package/lib/calculateCursorPosition.js +1 -1
  50. package/lib/dataURLToBlob.js +1 -1
  51. package/lib/divide.js +1 -0
  52. package/lib/formatBankCard.js +4 -8
  53. package/lib/formatMobile.js +9 -7
  54. package/lib/formatMoney.js +8 -14
  55. package/lib/isBankCard.js +6 -11
  56. package/lib/isBusinessLicense.js +7 -10
  57. package/lib/isChinese.js +10 -17
  58. package/lib/isEmail.js +2 -5
  59. package/lib/isHMCard.js +8 -8
  60. package/lib/isIPv4.js +4 -11
  61. package/lib/isIPv6.js +11 -29
  62. package/lib/isIdCard.js +9 -12
  63. package/lib/isMobile.js +2 -5
  64. package/lib/isPassport.js +2 -5
  65. package/lib/isPassword.js +14 -21
  66. package/lib/isPostcode.js +2 -5
  67. package/lib/isPromiseLike.js +4 -8
  68. package/lib/isQQ.js +2 -5
  69. package/lib/isSocialCreditCode.js +6 -11
  70. package/lib/isSwiftCode.js +5 -5
  71. package/lib/isTWCard.js +7 -4
  72. package/lib/isTelephone.js +7 -10
  73. package/lib/isUrl.js +8 -20
  74. package/lib/isVehicle.js +9 -14
  75. package/lib/isWX.js +2 -5
  76. package/lib/minus.js +4 -8
  77. package/lib/normalizeString.js +2 -0
  78. package/lib/numberToChinese.js +13 -19
  79. package/lib/padZero.js +9 -8
  80. package/lib/parseIdCard.js +3 -3
  81. package/lib/plus.js +4 -8
  82. package/lib/randomString.js +2 -0
  83. package/lib/replaceChar.js +9 -17
  84. package/lib/round.js +4 -8
  85. package/lib/safeDate.js +2 -0
  86. package/lib/setDataURLPrefix.js +2 -0
  87. package/lib/times.js +4 -8
  88. package/lib/utils/config.js +2 -1
  89. package/lib/waitTime.js +3 -1
  90. package/package.json +3 -3
  91. package/types/bytesToSize.d.ts +4 -10
  92. package/types/dataURLToBlob.d.ts +1 -1
  93. package/types/divide.d.ts +9 -8
  94. package/types/formatBankCard.d.ts +4 -8
  95. package/types/formatMobile.d.ts +9 -7
  96. package/types/formatMoney.d.ts +8 -14
  97. package/types/index.d.ts +1 -1
  98. package/types/isBankCard.d.ts +5 -10
  99. package/types/isBusinessLicense.d.ts +6 -9
  100. package/types/isChinese.d.ts +9 -16
  101. package/types/isEmail.d.ts +2 -5
  102. package/types/isHMCard.d.ts +8 -8
  103. package/types/isIPv4.d.ts +4 -11
  104. package/types/isIPv6.d.ts +11 -29
  105. package/types/isIdCard.d.ts +8 -11
  106. package/types/isMobile.d.ts +2 -5
  107. package/types/isPassport.d.ts +2 -5
  108. package/types/isPassword.d.ts +10 -17
  109. package/types/isPostcode.d.ts +2 -5
  110. package/types/isPromiseLike.d.ts +3 -7
  111. package/types/isQQ.d.ts +2 -5
  112. package/types/isSocialCreditCode.d.ts +6 -11
  113. package/types/isSwiftCode.d.ts +5 -5
  114. package/types/isTWCard.d.ts +7 -4
  115. package/types/isTelephone.d.ts +6 -9
  116. package/types/isUrl.d.ts +7 -19
  117. package/types/isVehicle.d.ts +8 -13
  118. package/types/isWX.d.ts +2 -5
  119. package/types/minus.d.ts +4 -8
  120. package/types/normalizeString.d.ts +2 -0
  121. package/types/numberToChinese.d.ts +10 -18
  122. package/types/padZero.d.ts +9 -8
  123. package/types/parseIdCard.d.ts +3 -3
  124. package/types/plus.d.ts +4 -8
  125. package/types/randomString.d.ts +2 -0
  126. package/types/replaceChar.d.ts +9 -17
  127. package/types/round.d.ts +3 -7
  128. package/types/safeDate.d.ts +2 -0
  129. package/types/setDataURLPrefix.d.ts +2 -0
  130. package/types/times.d.ts +4 -8
  131. package/types/utils/config.d.ts +2 -0
  132. package/types/utils/math.util.d.ts +4 -4
  133. package/types/waitTime.d.ts +3 -1
  134. package/types/src/blobToDataURL.d.ts +0 -25
  135. package/types/src/bytesToSize.d.ts +0 -24
  136. package/types/src/calculateCursorPosition.d.ts +0 -26
  137. package/types/src/dataURLToBlob.d.ts +0 -15
  138. package/types/src/divide.d.ts +0 -21
  139. package/types/src/formatBankCard.d.ts +0 -35
  140. package/types/src/formatMobile.d.ts +0 -27
  141. package/types/src/formatMoney.d.ts +0 -50
  142. package/types/src/index.d.ts +0 -45
  143. package/types/src/isBankCard.d.ts +0 -32
  144. package/types/src/isBusinessLicense.d.ts +0 -29
  145. package/types/src/isChinese.d.ts +0 -41
  146. package/types/src/isEmail.d.ts +0 -19
  147. package/types/src/isHMCard.d.ts +0 -24
  148. package/types/src/isIPv4.d.ts +0 -25
  149. package/types/src/isIPv6.d.ts +0 -50
  150. package/types/src/isIdCard.d.ts +0 -34
  151. package/types/src/isMobile.d.ts +0 -19
  152. package/types/src/isPassport.d.ts +0 -21
  153. package/types/src/isPassword.d.ts +0 -46
  154. package/types/src/isPostcode.d.ts +0 -19
  155. package/types/src/isPromiseLike.d.ts +0 -21
  156. package/types/src/isQQ.d.ts +0 -19
  157. package/types/src/isSocialCreditCode.d.ts +0 -31
  158. package/types/src/isSwiftCode.d.ts +0 -22
  159. package/types/src/isTWCard.d.ts +0 -23
  160. package/types/src/isTelephone.d.ts +0 -25
  161. package/types/src/isUrl.d.ts +0 -34
  162. package/types/src/isVehicle.d.ts +0 -29
  163. package/types/src/isWX.d.ts +0 -19
  164. package/types/src/minus.d.ts +0 -21
  165. package/types/src/normalizeString.d.ts +0 -22
  166. package/types/src/numberToChinese.d.ts +0 -57
  167. package/types/src/padZero.d.ts +0 -24
  168. package/types/src/parseIdCard.d.ts +0 -107
  169. package/types/src/plus.d.ts +0 -21
  170. package/types/src/randomString.d.ts +0 -19
  171. package/types/src/replaceChar.d.ts +0 -54
  172. package/types/src/round.d.ts +0 -22
  173. package/types/src/safeDate.d.ts +0 -22
  174. package/types/src/setDataURLPrefix.d.ts +0 -24
  175. package/types/src/strlen.d.ts +0 -20
  176. package/types/src/times.d.ts +0 -21
  177. package/types/src/utils/config.d.ts +0 -13
  178. package/types/src/utils/constants.d.ts +0 -2
  179. package/types/src/utils/convertToString.d.ts +0 -8
  180. package/types/src/utils/devWarn.d.ts +0 -7
  181. package/types/src/utils/math.util.d.ts +0 -63
  182. package/types/src/utils/type/index.d.ts +0 -19
  183. package/types/src/utils/type/isArguments.d.ts +0 -18
  184. package/types/src/utils/type/isArray.d.ts +0 -18
  185. package/types/src/utils/type/isBoolean.d.ts +0 -18
  186. package/types/src/utils/type/isDate.d.ts +0 -18
  187. package/types/src/utils/type/isError.d.ts +0 -18
  188. package/types/src/utils/type/isFunction.d.ts +0 -18
  189. package/types/src/utils/type/isMap.d.ts +0 -18
  190. package/types/src/utils/type/isNaN.d.ts +0 -18
  191. package/types/src/utils/type/isNil.d.ts +0 -11
  192. package/types/src/utils/type/isNull.d.ts +0 -18
  193. package/types/src/utils/type/isNumber.d.ts +0 -27
  194. package/types/src/utils/type/isObject.d.ts +0 -21
  195. package/types/src/utils/type/isRegExp.d.ts +0 -18
  196. package/types/src/utils/type/isSet.d.ts +0 -18
  197. package/types/src/utils/type/isString.d.ts +0 -18
  198. package/types/src/utils/type/isSymbol.d.ts +0 -18
  199. package/types/src/utils/type/isType.d.ts +0 -11
  200. package/types/src/utils/type/isUndefined.d.ts +0 -21
  201. package/types/src/utils/type/isWeakMap.d.ts +0 -18
  202. package/types/src/utils/type/isWeakSet.d.ts +0 -18
  203. package/types/src/validatePassword.d.ts +0 -134
  204. package/types/src/waitTime.d.ts +0 -20
@@ -1,50 +0,0 @@
1
- export default formatMoney;
2
- /**
3
- * 格式化金额
4
- *
5
- * @static
6
- * @alias module:Processor.formatMoney
7
- * @since 1.1.0
8
- * @param {string | number} num 需转换金额 (最大:9007199254740991 最小: -9007199254740991)
9
- * @param {Object} [options] - 金额格式化配置
10
- * @param {string | number} [options.precision=2] - 保留位数 (最高:10位)
11
- * @param {string} [options.symbol] - 货币符号
12
- * @param {string} [options.thousand=","] - 千分位符号
13
- * @param {string} [options.decimal="."] - 小数位符号
14
- * @returns {string} 格式化的金额
15
- * @example
16
- *
17
- * // 整数
18
- * formatMoney('1000');
19
- * // => 1,000.00
20
- *
21
- * // 小数(默认保留2位小数)
22
- * formatMoney('3000.03');
23
- * // => 3,000.03
24
- *
25
- * // 保留4位小数
26
- * formatMoney('3000.0300', { precision: 4 });
27
- * // => 3,000.0300
28
- *
29
- * // 保留10位小数
30
- * formatMoney('1500.2', { precision: 10 });
31
- * // => 1,500.2000000000
32
- *
33
- * // 自定义单位符号
34
- * formatMoney(1000.00, { symbol: '$' });
35
- * // => $1,000.00
36
- *
37
- * // 自定义千位分割符(默认',')
38
- * formatMoney(1000.00, { thousand: '|' });
39
- * // => 1|000.00
40
- *
41
- * // 自定义小数位分割符(默认'.')
42
- * formatMoney(1000.00, { decimal: '&' });
43
- * // => 1,000&00
44
- */
45
- declare function formatMoney(num: string | number, { precision, symbol, thousand, decimal }?: {
46
- precision?: string | number | undefined;
47
- symbol?: string | undefined;
48
- thousand?: string | undefined;
49
- decimal?: string | undefined;
50
- } | undefined): string;
@@ -1,45 +0,0 @@
1
- export { default as isMobile } from "./isMobile";
2
- export { default as isTelephone } from "./isTelephone";
3
- export { default as isPostcode } from "./isPostcode";
4
- export { default as isIdCard } from "./isIdCard";
5
- export { default as isEmail } from "./isEmail";
6
- export { default as isQQ } from "./isQQ";
7
- export { default as isWX } from "./isWX";
8
- export { default as isVehicle } from "./isVehicle";
9
- export { default as isBankCard } from "./isBankCard";
10
- export { default as isSocialCreditCode } from "./isSocialCreditCode";
11
- export { default as isPassword } from "./isPassword";
12
- export { default as isPassport } from "./isPassport";
13
- export { default as isChinese } from "./isChinese";
14
- export { default as isIPv4 } from "./isIPv4";
15
- export { default as isIPv6 } from "./isIPv6";
16
- export { default as isUrl } from "./isUrl";
17
- export { default as isBusinessLicense } from "./isBusinessLicense";
18
- export { default as validatePassword } from "./validatePassword";
19
- export { default as isPromiseLike } from "./isPromiseLike";
20
- export { default as isHMCard } from "./isHMCard";
21
- export { default as isTWCard } from "./isTWCard";
22
- export { default as isSwiftCode } from "./isSwiftCode";
23
- export { default as formatMoney } from "./formatMoney";
24
- export { default as formatBankCard } from "./formatBankCard";
25
- export { default as replaceChar } from "./replaceChar";
26
- export { default as numberToChinese } from "./numberToChinese";
27
- export { default as bytesToSize } from "./bytesToSize";
28
- export { default as parseIdCard } from "./parseIdCard";
29
- export { default as blobToDataURL } from "./blobToDataURL";
30
- export { default as dataURLToBlob } from "./dataURLToBlob";
31
- export { default as setDataURLPrefix } from "./setDataURLPrefix";
32
- export { default as normalizeString } from "./normalizeString";
33
- export { default as safeDate } from "./safeDate";
34
- export { default as formatMobile } from "./formatMobile";
35
- export { default as padZero } from "./padZero";
36
- export { default as plus } from "./plus";
37
- export { default as minus } from "./minus";
38
- export { default as times } from "./times";
39
- export { default as divide } from "./divide";
40
- export { default as round } from "./round";
41
- export { default as waitTime } from "./waitTime";
42
- export { default as calculateCursorPosition } from "./calculateCursorPosition";
43
- export { default as randomString } from "./randomString";
44
- export { default as strlen } from "./strlen";
45
- export { setDisableWarning, version } from "./utils/config";
@@ -1,32 +0,0 @@
1
- export default isBankCard;
2
- /**
3
- * 检测值是否为银行卡号。正常模式(非0开头,10~21位数字)宽松模式(8~30位数字)
4
- *
5
- * @static
6
- * @alias module:Validator.isBankCard
7
- * @see 参考 {@link https://kf.qq.com/faq/170112ABnm6b170112FvquAn.html|常用银行账号位数参考}
8
- * @since 1.1.0
9
- * @param {*} value 要检测的值
10
- * @param {Object} [options] 配置项
11
- * @param {boolean} [options.loose=false] 宽松模式,8~30位数字
12
- * @param {boolean} [options.luhn=false] 使用 Luhn 算法校验校验码
13
- * @returns {boolean} 值是否为银行卡号
14
- * @example
15
- *
16
- * isBankCard('6228480402564890018');
17
- * // => true
18
- *
19
- * isBankCard('6228480402564890');
20
- * // => true
21
- *
22
- * isBankCard('123456789');
23
- * // => false
24
- *
25
- * isBankCard('123456789', { loose: true });
26
- * // => true
27
- *
28
- */
29
- declare function isBankCard(value: any, { loose, luhn }?: {
30
- loose?: boolean | undefined;
31
- luhn?: boolean | undefined;
32
- } | undefined): boolean;
@@ -1,29 +0,0 @@
1
- export default isBusinessLicense;
2
- /**
3
- * 检测值是否为营业执照号,也叫工商注册号。由14位数字本体码和1位数字校验码组成,其中本体码从左至右依次为:6位首次登记机关码、8位顺序码。
4
- *
5
- * @static
6
- * @alias module:Validator.isBusinessLicense
7
- * @see 参考 {@link https://wenku.baidu.com/view/19873704cc1755270722087c.html|GS15—2006 工商行政管理市场主体注册号编制规则}
8
- * @since 3.5.0
9
- * @param {*} value 要检测的值
10
- * @param {Object} [options] 配置项
11
- * @param {boolean} [options.checkCode=true] 是否校验最后一位校验码,如果为false,不校验校验位。
12
- * @returns {boolean} 值是否为营业执照号
13
- * @example
14
- *
15
- * isBusinessLicense('310115600985533');
16
- * // => true
17
- *
18
- * isBusinessLicense('310115600985535');
19
- * // => false
20
- *
21
- * isBusinessLicense('310115600985535', { checkCode: false });
22
- * // => true
23
- *
24
- * isBusinessLicense('31011560098', { checkCode: false });
25
- * // => false
26
- */
27
- declare function isBusinessLicense(value: any, options?: {
28
- checkCode?: boolean | undefined;
29
- } | undefined): boolean;
@@ -1,41 +0,0 @@
1
- export default isChinese;
2
- /**
3
- * 检测值是否为中文
4
- *
5
- * @static
6
- * @alias module:Validator.isChinese
7
- * @since 1.1.0
8
- * @see 参考 {@link http://www.unicode.org/reports/tr38/#BlockListing|4.4 Listing of Characters Covered by the Unihan Database}
9
- * @param {*} value 要检测的值
10
- * @param {Object} [options] 配置项
11
- * @param {boolean} [options.loose=false] 宽松模式。如果为true,只要包含中文即为true
12
- * @param {boolean} [options.useExtend=false] 使用统一表意文字扩展A-F。注意:如果不支持 `RegExp.prototype.unicode`,扩展字符集将自动不生效,如IE浏览器。
13
- * @returns {boolean} 值是否为中文
14
- * @example
15
- *
16
- * isChinese('林某某');
17
- * // => true
18
- *
19
- * isChinese('林A');
20
- * // => false
21
- *
22
- * // 宽松模式,只要包含中文即为true
23
- * isChinese('林A', { loose: true });
24
- * // => true
25
- *
26
- * isChinese('A林A', { loose: true });
27
- * // => true
28
- *
29
- * isChinese('𠮷');
30
- * // => false
31
- *
32
- * // 使用中文扩展字符集,需要浏览器支持 RegExp.prototype.unicode 才生效。
33
- * isChinese('𠮷', { useExtend: true });
34
- * // => true
35
- * isChinese('𠮷aa', { useExtend: true, loose: true });
36
- * // => true
37
- */
38
- declare function isChinese(value: any, { loose, useExtend }?: {
39
- loose?: boolean | undefined;
40
- useExtend?: boolean | undefined;
41
- } | undefined): boolean;
@@ -1,19 +0,0 @@
1
- export default isEmail;
2
- /**
3
- * 检测值是否为Email
4
- *
5
- * @static
6
- * @alias module:Validator.isEmail
7
- * @since 1.1.0
8
- * @param {*} value 要检测的值
9
- * @returns {boolean} 值是否为Email
10
- * @example
11
- *
12
- * isEmail('1232@qq.com');
13
- * // => true
14
- *
15
- * isEmail('123@');
16
- * // => false
17
- *
18
- */
19
- declare function isEmail(value: any): boolean;
@@ -1,24 +0,0 @@
1
- export default isHMCard;
2
- /**
3
- * 检测值是否为港澳居民来往内地通行证,俗称回乡证或回乡卡。
4
- *
5
- * @static
6
- * @alias module:Validator.isHMCard
7
- * @since 4.0.0
8
- * @see 参考 {@link https://zh.wikipedia.org/wiki/港澳居民来往内地通行证|港澳居民来往内地通行证}
9
- * @param {*} value 要检测的值
10
- * @returns {boolean} 是否为港澳居民来往内地通行证
11
- * @example
12
- * // 第一代 11 位
13
- * isHMCard('h3203117707') // true
14
- * isHMCard('H3203117707') // true
15
- * isHMCard('m3203117707') // true
16
- * isHMCard('M3203117707') // true
17
- *
18
- * // 第二代 9 位
19
- * isHMCard('h32031177') // true
20
- * isHMCard('H32031177') // true
21
- * isHMCard('m32031177') // true
22
- * isHMCard('M32031177') // true
23
- */
24
- declare function isHMCard(value: any): boolean;
@@ -1,25 +0,0 @@
1
- export default isIPv4;
2
- /**
3
- * 检测值是否为ipv4
4
- *
5
- * @static
6
- * @alias module:Validator.isIPv4
7
- * @since 1.1.0
8
- * @param {*} value 要检测的值
9
- * @returns {boolean} 值是否为ipv4
10
- * @example
11
- *
12
- * isIPv4('192.168.1.1');
13
- * // => true
14
- *
15
- * isIPv4('255.255.255.255');
16
- * // => true
17
- *
18
- * isIPv4('256.256.256.256');
19
- * // => false
20
- *
21
- * isIPv4('0.0');
22
- * // => false
23
- *
24
- */
25
- declare function isIPv4(value: any): boolean;
@@ -1,50 +0,0 @@
1
- export default isIPv6;
2
- /**
3
- * 检测值是否为ipv6
4
- *
5
- * @static
6
- * @alias module:Validator.isIPv6
7
- * @since 1.1.0
8
- * @param {*} value 要检测的值
9
- * @returns {boolean} 值是否为ipv6
10
- * @example
11
- *
12
- * // 冒分十六进制表示法
13
- * isIPv6('2001:0DB8:0000:0023:0008:0800:200C:417A');
14
- * // => true
15
- *
16
- * // 前导0省略
17
- * isIPv6('2001:DB8:0:23:8:800:200C:417A');
18
- * // => true
19
- *
20
- * isIPv6('FF01:0:0:0:0:0:0:1101');
21
- * // => true
22
- *
23
- * // 0位压缩表示法
24
- * isIPv6('FF01::1101');
25
- * // => true
26
- *
27
- * isIPv6('::1');
28
- * // => true
29
- *
30
- * isIPv6('::');
31
- * // => true
32
- *
33
- * isIPv6('0:0:0:0:0:0:0:1');
34
- * // => true
35
- *
36
- * isIPv6('0:0:0:0:0:0:0:0');
37
- * // => true
38
- *
39
- * // 内嵌IPv4地址表示法
40
- * isIPv6('::192.168.1.1');
41
- * // => true
42
- *
43
- * isIPv6('::FFFF:192.168.1.1');
44
- * // => true
45
- *
46
- * isIPv6('192.168.1.1');
47
- * // => false
48
- *
49
- */
50
- declare function isIPv6(value: any): boolean;
@@ -1,34 +0,0 @@
1
- export default isIdCard;
2
- /**
3
- * 检测值是否为18位身份证号码。<br/>宽松模式下,支持15位身份证号码
4
- *
5
- * @static
6
- * @alias module:Validator.isIdCard
7
- * @since 1.1.0
8
- * @param {*} value 要检测的值
9
- * @param {Object} [options] 配置项
10
- * @param {boolean} [options.loose=false] 宽松模式,支持15位身份证号码
11
- * @param {boolean} [options.checkCode=true] 是否校验最后一位校验码,仅支持18位身份证号码
12
- * @returns {boolean} 值是否为身份证号
13
- * @example
14
- *
15
- * isIdCard('130701199310302288');
16
- * // => true
17
- *
18
- * isIdCard('13070119931030228X');
19
- * // => false
20
- *
21
- * isIdCard('13070119931030228X', { checkCode: false }); // 不校验校验码
22
- * // => true
23
- *
24
- * isIdCard('320311770706001');
25
- * // => false
26
- *
27
- * isIdCard('320311770706001', { loose: true });
28
- * // => true
29
- *
30
- */
31
- declare function isIdCard(value: any, { loose, checkCode }?: {
32
- loose?: boolean | undefined;
33
- checkCode?: boolean | undefined;
34
- } | undefined): boolean;
@@ -1,19 +0,0 @@
1
- export default isMobile;
2
- /**
3
- * 检测值是否为手机号码
4
- *
5
- * @static
6
- * @alias module:Validator.isMobile
7
- * @since 1.1.0
8
- * @param {*} value 要检测的值
9
- * @returns {boolean} 值是否为手机号码
10
- * @example
11
- *
12
- * isMobile('13000000000');
13
- * // => true
14
- *
15
- * isMobile('13000');
16
- * // => false
17
- *
18
- */
19
- declare function isMobile(value: any): boolean;
@@ -1,21 +0,0 @@
1
- export default isPassport;
2
- /**
3
- * 检测值是否为护照号
4
- * 支持普通护照(E*)、外交护照(DE)、公务护照(SE)、公务普通护照(PE)、香港特区护照(K/KJ/H*)、澳门特区护照(MA/MB/M*),注意不区分大小写
5
- *
6
- * @static
7
- * @alias module:Validator.isPassport
8
- * @see 参考 {@link https://zh.wikipedia.org/wiki/中华人民共和国护照#个人资料页|中华人民共和国护照#个人资料页}
9
- * @since 1.1.0
10
- * @param {*} value 要检测的值
11
- * @returns {boolean} 值是否为护照号
12
- * @example
13
- *
14
- * isPassport('E12345678');
15
- * // => true
16
- *
17
- * isPassport('abc');
18
- * // => false
19
- *
20
- */
21
- declare function isPassport(value: any): boolean;
@@ -1,46 +0,0 @@
1
- export default isPassword;
2
- /**
3
- * 检测值是否符合密码强度
4
- * <p><strong>注意:该校验只校验是否存在不同字符(大小写字母、数字、特殊符号),不判断长度。</strong></p>
5
- * <p><i>如果需要更细致的验证,请使用 <a href="#.validatePassword">validatePassword</a></i></p>
6
- *
7
- * @see 参考 {@link https://baike.baidu.com/item/ASCII#3|ASCII}
8
- * @static
9
- * @alias module:Validator.isPassword
10
- * @since 1.1.0
11
- * @requires module:Validator.validatePassword
12
- * @param {*} value 要检测的值
13
- * @param {Object} [options] 配置项
14
- * @param {number} [options.level=2] 密码强度 1-包含一种字符 2-包含两种字符 3-包含三种字符。(大写字母、小写字母、数字、特殊字符)
15
- * @param {boolean} [options.ignoreCase=false] 是否忽略大小写,为 ture 时,大小写字母视为一种字符
16
- * @param {string} [options.special="!@#$%^&*()-=_+[]\|{},./?<>~"] 支持的特殊字符
17
- * @returns {boolean} 值是否符合密码强度
18
- * @example
19
- *
20
- * isPassword('a12345678');
21
- * // => true
22
- *
23
- * isPassword('a12345678', {level: 3});
24
- * // => false
25
- *
26
- * isPassword('Aa12345678', {level: 3});
27
- * // => true
28
- *
29
- * isPassword('Aa12345678', {level: 3, ignoreCase: true});
30
- * // => false
31
- *
32
- * isPassword('_Aa12345678', {level: 3, ignoreCase: true});
33
- * // => true
34
- *
35
- * // 仅支持 数字、字母、特殊字符,其他字符如中文字符是校验不通过的
36
- * isPassword('_Aa一二三45678', {level: 3, ignoreCase: true});
37
- * // => false
38
- *
39
- * isPassword(' _Aa12345678', {level: 3, ignoreCase: true});
40
- * // => false
41
- */
42
- declare function isPassword(value: any, { level, ignoreCase, special }?: {
43
- level?: number | undefined;
44
- ignoreCase?: boolean | undefined;
45
- special?: string | undefined;
46
- } | undefined): boolean;
@@ -1,19 +0,0 @@
1
- export default isPostcode;
2
- /**
3
- * 检测值是否为邮政编码,6位数字
4
- *
5
- * @static
6
- * @alias module:Validator.isPostcode
7
- * @since 1.1.0
8
- * @param {*} value 要检测的值
9
- * @returns {boolean} 值是否为邮政编码
10
- * @example
11
- *
12
- * isPostcode('101111');
13
- * // => true
14
- *
15
- * isPostcode('123');
16
- * // => false
17
- *
18
- */
19
- declare function isPostcode(value: any): boolean;
@@ -1,21 +0,0 @@
1
- export default isPromiseLike;
2
- /**
3
- * 检测值是否类似Promise对象
4
- *
5
- * @static
6
- * @alias module:Validator.isPromiseLike
7
- * @since 3.8.0
8
- * @param {*} obj 要检测的值
9
- * @returns {boolean} 是否类似Promise对象
10
- * @example
11
- *
12
- * isPromiseLike([]);
13
- * => false
14
- *
15
- * isPromiseLike({then:()=>{}});
16
- * => true
17
- *
18
- * isPromiseLike(Promise.resolve());
19
- * => true
20
- */
21
- declare function isPromiseLike(obj: any): boolean;
@@ -1,19 +0,0 @@
1
- export default isQQ;
2
- /**
3
- * 检测值是否为QQ号,非0开头,5至11位数字
4
- *
5
- * @static
6
- * @alias module:Validator.isQQ
7
- * @since 1.1.0
8
- * @param {*} value 要检测的值
9
- * @returns {boolean} 值是否为QQ号
10
- * @example
11
- *
12
- * isQQ('12345');
13
- * // => true
14
- *
15
- * isQQ('123');
16
- * // => false
17
- *
18
- */
19
- declare function isQQ(value: any): boolean;
@@ -1,31 +0,0 @@
1
- export default isSocialCreditCode;
2
- /**
3
- * 检测值是否为统一社会信用代码,也叫三证合一组织代码。由18位数字和大写字母组成,不使用I、O、Z、S、V。
4
- *
5
- * @static
6
- * @alias module:Validator.isSocialCreditCode
7
- * @see 参考 {@link https://zh.wikisource.org/zh-hans/GB_32100-2015_法人和其他组织统一社会信用代码编码规则|GB 32100-2015 法人和其他组织统一社会信用代码编码规则}
8
- * @since 1.1.0
9
- * @param {*} value 要检测的值
10
- * @param {Object} [options] 配置项
11
- * @param {boolean} [options.checkCode=true] 是否校验最后一位校验码,如果为false,不校验校验位。
12
- * @returns {boolean} 值是否为统一社会信用代码
13
- * @example
14
- *
15
- * isSocialCreditCode('91350100M000100Y43');
16
- * // => true
17
- *
18
- * isSocialCreditCode('91350100M000100Y4A');
19
- * // => false
20
- *
21
- * // 不校验校验位
22
- * isSocialCreditCode('91350100M000100Y4A', { checkCode: false });
23
- * // => true
24
- *
25
- * isSocialCreditCode('91350100M000100Y', { checkCode: false });
26
- * // => false
27
- *
28
- */
29
- declare function isSocialCreditCode(value: any, options?: {
30
- checkCode?: boolean | undefined;
31
- } | undefined): boolean;
@@ -1,22 +0,0 @@
1
- export default isSwiftCode;
2
- /**
3
- * 检测值是否为 Swift Code。8位或11位,前6位为大写字母,7-8位为大写字母或数字,9-11位为可选的大写字母或数字。
4
- *
5
- * @static
6
- * @alias module:Validator.isSwiftCode
7
- * @see 参考 {@link https://zh.wikipedia.org/wiki/ISO_9362|ISO 9362}
8
- * @since 4.9.0
9
- * @param {*} value 要检测的值
10
- * @returns {boolean} 值是否为 Swift Code
11
- * @example
12
- *
13
- * isSwiftCode('DEUTDEFF') // true
14
- * isSwiftCode('deutdeff') // false
15
- *
16
- * isSwiftCode('BKTWTWTP010') // true
17
- * isSwiftCode('010BKTWTWTP') // false
18
- *
19
- * isSwiftCode('ICBKCNBJBJM') // true
20
- *
21
- */
22
- declare function isSwiftCode(value: any): boolean;
@@ -1,23 +0,0 @@
1
- export default isTWCard;
2
- /**
3
- * 检测值是否为台湾居民来往大陆通行证,俗称台胞证。
4
- *
5
- * @static
6
- * @alias module:Validator.isTWCard
7
- * @since 4.0.0
8
- * @see 参考 {@link https://zh.wikipedia.org/wiki/台湾居民来往大陆通行证|台湾居民来往大陆通行证}
9
- * @param {*} value 要检测的值
10
- * @param {Object} [options] 配置项
11
- * @param {boolean} [options.loose=false] 宽松模式。如果为true,表示支持一次性短期通行证
12
- * @returns {boolean} 是否为台湾居民来往大陆通行证
13
- * @example
14
- * isTWCard('12345678') // true
15
- * isTWCard('07257456') // true
16
- *
17
- * // 一次性短期
18
- * isTWCard('F290299977') // false
19
- * isTWCard('F290299977', { loose: true }) // true
20
- */
21
- declare function isTWCard(value: any, { loose }?: {
22
- loose?: boolean | undefined;
23
- } | undefined): boolean;
@@ -1,25 +0,0 @@
1
- export default isTelephone;
2
- /**
3
- * 检测值是否为固定电话
4
- *
5
- * @static
6
- * @alias module:Validator.isTelephone
7
- * @since 1.1.0
8
- * @param {*} value 要检测的值
9
- * @returns {boolean} 值是否为固定电话
10
- * @example
11
- *
12
- * isTelephone('22033212');
13
- * // => true
14
- *
15
- * isTelephone('021-22033212');
16
- * // => true
17
- *
18
- * isTelephone('021-22033212-123');
19
- * // => true
20
- *
21
- * isTelephone('13000000000');
22
- * // => false
23
- *
24
- */
25
- declare function isTelephone(value: any): boolean;
@@ -1,34 +0,0 @@
1
- export default isUrl;
2
- /**
3
- * 检测值是否为url
4
- *
5
- * @static
6
- * @alias module:Validator.isUrl
7
- * @since 3.4.0
8
- * @see 参考 {@link https://zh.wikipedia.org/wiki/统一资源定位符|统一资源定位符}
9
- * @param {*} value 要检测的值
10
- * @returns {boolean} 值是否为url
11
- * @example
12
- *
13
- * isUrl('');
14
- * // => false
15
- *
16
- * isUrl('8.8.8.8');
17
- * // => false
18
- *
19
- * isUrl('example.com');
20
- * // => true
21
- *
22
- * isUrl('http://example.com');
23
- * // => true
24
- *
25
- * isUrl('https://example.com:8080');
26
- * // => true
27
- *
28
- * isUrl('http://www.example.com/test/123');
29
- * // => true
30
- *
31
- * isUrl('http://www.example.com/test/123?foo=bar');
32
- * // => true
33
- */
34
- declare function isUrl(value: any): boolean;