util-helpers 5.1.2 → 5.2.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.
- package/README.md +1 -0
- package/dist/util-helpers.js +681 -72
- package/dist/util-helpers.js.map +1 -1
- package/dist/util-helpers.min.js +1 -1
- package/dist/util-helpers.min.js.map +1 -1
- package/esm/VERSION.js +1 -1
- package/esm/getFileType.js +2 -2
- package/esm/getMimeType.js +43 -0
- package/esm/index.js +1 -0
- package/lib/VERSION.js +1 -1
- package/lib/getFileType.js +2 -2
- package/lib/getMimeType.js +45 -0
- package/lib/index.js +2 -0
- package/package.json +18 -18
- package/types/AsyncMemo.d.ts +2 -2
- package/types/BlobUrl.d.ts +41 -0
- package/types/ajax.d.ts +2 -2
- package/types/bytesToSize.d.ts +2 -2
- package/types/calculateCursorPosition.d.ts +4 -4
- package/types/checkFileType.d.ts +2 -2
- package/types/compressImage.d.ts +7 -6
- package/types/dataURLToBlob.d.ts +1 -1
- package/types/download.d.ts +5 -3
- package/types/fileReader.d.ts +2 -2
- package/types/filterTree.d.ts +2 -2
- package/types/findTreeNode.d.ts +1 -1
- package/types/findTreeNodes.d.ts +1 -1
- package/types/findTreeSelect.d.ts +1 -1
- package/types/formatBankCard.d.ts +2 -2
- package/types/formatMobile.d.ts +1 -1
- package/types/formatMoney.d.ts +4 -4
- package/types/gcd.d.ts +1 -1
- package/types/getFileType.d.ts +1 -1
- package/types/getMimeType.d.ts +25 -0
- package/types/index.d.ts +3 -2
- package/types/isBankCard.d.ts +3 -3
- package/types/isBusinessLicense.d.ts +2 -2
- package/types/isChinese.d.ts +5 -5
- package/types/isHMCard.d.ts +1 -1
- package/types/isIdCard.d.ts +4 -4
- package/types/isPassport.d.ts +1 -1
- package/types/isPassword.d.ts +4 -4
- package/types/isSocialCreditCode.d.ts +1 -1
- package/types/isSwiftCode.d.ts +1 -1
- package/types/isTWCard.d.ts +2 -2
- package/types/isUrl.d.ts +1 -1
- package/types/isValidNumber.d.ts +1 -1
- package/types/isVehicle.d.ts +1 -1
- package/types/lcm.d.ts +1 -1
- package/types/listToTree.d.ts +5 -5
- package/types/loadScript.d.ts +3 -3
- package/types/numberToChinese.d.ts +8 -8
- package/types/padZero.d.ts +1 -1
- package/types/parseIdCard.d.ts +1 -1
- package/types/randomString.d.ts +2 -2
- package/types/replaceChar.d.ts +3 -3
- package/types/round.d.ts +1 -1
- package/types/safeDate.d.ts +1 -1
- package/types/setDataURLPrefix.d.ts +4 -4
- package/types/transformFieldNames.d.ts +1 -1
- package/types/transformObjectValue.d.ts +1 -1
- package/types/validatePassword.d.ts +4 -4
package/types/isChinese.d.ts
CHANGED
|
@@ -8,13 +8,13 @@ type Options = {
|
|
|
8
8
|
* @static
|
|
9
9
|
* @alias module:Validator.isChinese
|
|
10
10
|
* @since 1.1.0
|
|
11
|
-
* @see {@link http://www.unicode.org/reports/tr38/#BlockListing 4.4 Listing of Characters Covered by the Unihan Database}
|
|
12
|
-
* @see {@link https://zh.wikipedia.org/wiki/Unicode字符平面映射 Unicode字符平面映射}
|
|
13
|
-
* @see {@link https://zh.wikipedia.org/wiki/Unicode區段 Unicode区段}
|
|
11
|
+
* @see {@link http://www.unicode.org/reports/tr38/#BlockListing | 4.4 Listing of Characters Covered by the Unihan Database}
|
|
12
|
+
* @see {@link https://zh.wikipedia.org/wiki/Unicode字符平面映射 | Unicode字符平面映射}
|
|
13
|
+
* @see {@link https://zh.wikipedia.org/wiki/Unicode區段 | Unicode区段}
|
|
14
14
|
* @param {*} value 要检测的值
|
|
15
15
|
* @param {Object} [options] 配置项
|
|
16
|
-
* @param {boolean} [options.loose=false]
|
|
17
|
-
* @param {boolean} [options.useExtend=false] 使用统一表意文字扩展A-I
|
|
16
|
+
* @param {boolean} [options.loose=false] 宽松模式,默认`false`。如果为`true`,只要包含中文就返回`true`
|
|
17
|
+
* @param {boolean} [options.useExtend=false] 使用统一表意文字扩展A-I,默认`false`。注意:如果不支持 `RegExp.prototype.unicode`,扩展字符集将自动不生效,如IE浏览器。
|
|
18
18
|
* @returns {boolean} 值是否为中文
|
|
19
19
|
* @example
|
|
20
20
|
*
|
package/types/isHMCard.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @static
|
|
5
5
|
* @alias module:Validator.isHMCard
|
|
6
6
|
* @since 4.0.0
|
|
7
|
-
* @see {@link https://zh.wikipedia.org/wiki/港澳居民来往内地通行证 港澳居民来往内地通行证}
|
|
7
|
+
* @see {@link https://zh.wikipedia.org/wiki/港澳居民来往内地通行证 | 港澳居民来往内地通行证}
|
|
8
8
|
* @param {*} value 要检测的值
|
|
9
9
|
* @returns {boolean} 是否为港澳居民来往内地通行证
|
|
10
10
|
* @example
|
package/types/isIdCard.d.ts
CHANGED
|
@@ -10,12 +10,12 @@ type Options = {
|
|
|
10
10
|
* @static
|
|
11
11
|
* @alias module:Validator.isIdCard
|
|
12
12
|
* @since 1.1.0
|
|
13
|
-
* @see {@link https://zh.wikipedia.org/wiki/中华人民共和国公民身份号码 中华人民共和国公民身份号码}
|
|
14
|
-
* @see {@link https://baike.baidu.com/item/居民身份证号码 居民身份证号码}
|
|
13
|
+
* @see {@link https://zh.wikipedia.org/wiki/中华人民共和国公民身份号码 | 中华人民共和国公民身份号码}
|
|
14
|
+
* @see {@link https://baike.baidu.com/item/居民身份证号码 | 居民身份证号码}
|
|
15
15
|
* @param {*} value 要检测的值
|
|
16
16
|
* @param {Object} [options] 配置项
|
|
17
|
-
* @param {boolean} [options.loose=false]
|
|
18
|
-
* @param {boolean} [options.checkCode=true]
|
|
17
|
+
* @param {boolean} [options.loose=false] 宽松模式,默认`false`。如果为`true`,支持15位身份证号码
|
|
18
|
+
* @param {boolean} [options.checkCode=true] 是否校验最后一位校验码,默认`true`。仅在`loose=false`时生效
|
|
19
19
|
* @returns {boolean} 值是否为身份证号
|
|
20
20
|
* @example
|
|
21
21
|
*
|
package/types/isPassport.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @static
|
|
6
6
|
* @alias module:Validator.isPassport
|
|
7
7
|
* @since 1.1.0
|
|
8
|
-
* @see {@link https://zh.wikipedia.org/wiki/中华人民共和国护照#个人资料页 中华人民共和国护照#个人资料页}
|
|
8
|
+
* @see {@link https://zh.wikipedia.org/wiki/中华人民共和国护照#个人资料页 | 中华人民共和国护照#个人资料页}
|
|
9
9
|
* @param {*} value 要检测的值
|
|
10
10
|
* @returns {boolean} 值是否为护照号
|
|
11
11
|
* @example
|
package/types/isPassword.d.ts
CHANGED
|
@@ -8,12 +8,12 @@ import validatePassword from './validatePassword';
|
|
|
8
8
|
* @alias module:Validator.isPassword
|
|
9
9
|
* @requires module:Validator.validatePassword
|
|
10
10
|
* @since 1.1.0
|
|
11
|
-
* @see {@link https://baike.baidu.com/item/ASCII#3 ASCII}
|
|
11
|
+
* @see {@link https://baike.baidu.com/item/ASCII#3 | ASCII}
|
|
12
12
|
* @param {*} value 要检测的值
|
|
13
13
|
* @param {Object} [options] 配置项
|
|
14
|
-
* @param {number} [options.level=2]
|
|
15
|
-
* @param {boolean} [options.ignoreCase=false]
|
|
16
|
-
* @param {string} [options.special="!@#$%^&*()-=_+[]\|{},./?<>~"]
|
|
14
|
+
* @param {number} [options.level=2] 密码强度,默认`2`。`1`-包含一种字符 `2`-包含两种字符 `3`-包含三种字符。(大写字母、小写字母、数字、特殊字符)
|
|
15
|
+
* @param {boolean} [options.ignoreCase=false] 是否忽略大小写,默认`false`。为 ture 时,大小写字母视为一种字符
|
|
16
|
+
* @param {string} [options.special="!@#$%^&*()-=_+[]\|{},./?<>~"] 支持的特殊字符,默认`!@#$%^&*()-=_+[]\|{},./?<>~`
|
|
17
17
|
* @returns {boolean} 值是否符合密码强度
|
|
18
18
|
* @example
|
|
19
19
|
*
|
|
@@ -7,7 +7,7 @@ type Options = {
|
|
|
7
7
|
* @static
|
|
8
8
|
* @alias module:Validator.isSocialCreditCode
|
|
9
9
|
* @since 1.1.0
|
|
10
|
-
* @see {@link https://zh.wikisource.org/zh-hans/GB_32100-2015_法人和其他组织统一社会信用代码编码规则 GB 32100-2015 法人和其他组织统一社会信用代码编码规则}
|
|
10
|
+
* @see {@link https://zh.wikisource.org/zh-hans/GB_32100-2015_法人和其他组织统一社会信用代码编码规则 | GB 32100-2015 法人和其他组织统一社会信用代码编码规则}
|
|
11
11
|
* @param {*} value 要检测的值
|
|
12
12
|
* @param {Object} [options] 配置项
|
|
13
13
|
* @param {boolean} [options.checkCode=true] 是否校验最后一位校验码,如果为false,不校验校验位。
|
package/types/isSwiftCode.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @static
|
|
5
5
|
* @alias module:Validator.isSwiftCode
|
|
6
6
|
* @since 4.9.0
|
|
7
|
-
* @see {@link https://zh.wikipedia.org/wiki/ISO_9362 ISO 9362}
|
|
7
|
+
* @see {@link https://zh.wikipedia.org/wiki/ISO_9362 | ISO 9362}
|
|
8
8
|
* @param {*} value 要检测的值
|
|
9
9
|
* @returns {boolean} 值是否为 Swift Code
|
|
10
10
|
* @example
|
package/types/isTWCard.d.ts
CHANGED
|
@@ -7,10 +7,10 @@ type Options = {
|
|
|
7
7
|
* @static
|
|
8
8
|
* @alias module:Validator.isTWCard
|
|
9
9
|
* @since 4.0.0
|
|
10
|
-
* @see {@link https://zh.wikipedia.org/wiki/台湾居民来往大陆通行证 台湾居民来往大陆通行证}
|
|
10
|
+
* @see {@link https://zh.wikipedia.org/wiki/台湾居民来往大陆通行证 | 台湾居民来往大陆通行证}
|
|
11
11
|
* @param {*} value 要检测的值
|
|
12
12
|
* @param {Object} [options] 配置项
|
|
13
|
-
* @param {boolean} [options.loose=false]
|
|
13
|
+
* @param {boolean} [options.loose=false] 宽松模式,默认`false`。如果为true,表示支持一次性短期通行证
|
|
14
14
|
* @returns {boolean} 是否为台湾居民来往大陆通行证
|
|
15
15
|
* @example
|
|
16
16
|
*
|
package/types/isUrl.d.ts
CHANGED
package/types/isValidNumber.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @alias module:Validator.isValidNumber
|
|
6
6
|
* @since 4.17.2
|
|
7
7
|
* @param {*} value 待检测的值
|
|
8
|
-
* @param {boolean} [strict=false]
|
|
8
|
+
* @param {boolean} [strict=false] 严格模式,默认`false`。如果为 true ,仅支持字符串和数字类型,不处理其他类型隐式转换,且空字符串返回 false 。
|
|
9
9
|
* @returns {boolean} 值是否为有效数值
|
|
10
10
|
* @example
|
|
11
11
|
*
|
package/types/isVehicle.d.ts
CHANGED
package/types/lcm.d.ts
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* @static
|
|
15
15
|
* @alias module:Math.lcm
|
|
16
16
|
* @since 4.20.0
|
|
17
|
-
* @see {@link https://baike.baidu.com/item/最小公倍数 最小公倍数}
|
|
17
|
+
* @see {@link https://baike.baidu.com/item/最小公倍数 | 最小公倍数}
|
|
18
18
|
* @param {...(number|string)} nums 两个或多个整数。
|
|
19
19
|
* @returns {number} 最小公倍数。
|
|
20
20
|
* @example
|
package/types/listToTree.d.ts
CHANGED
|
@@ -14,11 +14,11 @@ type Options = {
|
|
|
14
14
|
* @since 4.14.0
|
|
15
15
|
* @param {Object[]} list 列表数据
|
|
16
16
|
* @param {Object} [options] 配置项
|
|
17
|
-
* @param {string} [options.keyField='id']
|
|
18
|
-
* @param {string} [options.parentField='pid']
|
|
19
|
-
* @param {string} [options.childrenField='children']
|
|
20
|
-
* @param {'none'|'null'|'array'} [options.emptyChildrenValue='none']
|
|
21
|
-
* @param {'spread'|'self'} [options.nodeAssign='spread']
|
|
17
|
+
* @param {string} [options.keyField='id'] 当前数据的键值字段名称,默认`id`
|
|
18
|
+
* @param {string} [options.parentField='pid'] 当前数据的父级字段名称,默认`pid`
|
|
19
|
+
* @param {string} [options.childrenField='children'] 子级字段名称,默认`children`
|
|
20
|
+
* @param {'none'|'null'|'array'} [options.emptyChildrenValue='none'] 子级为空时的值,默认`none`。`none`表示删除该子级,`null`表示为`null`,`array`表示为`[]`。
|
|
21
|
+
* @param {'spread'|'self'} [options.nodeAssign='spread'] 节点赋值方式,默认`spread`。`spread`表示使用展开运算符创建新值,`self`表示使用自身对象。
|
|
22
22
|
* @returns {Object[]} 树结构
|
|
23
23
|
* @example
|
|
24
24
|
*
|
package/types/loadScript.d.ts
CHANGED
|
@@ -12,10 +12,10 @@ type ScriptAttribute = Pick<HTMLScriptElement, 'async' | 'crossOrigin' | 'defer'
|
|
|
12
12
|
* @since 4.19.0
|
|
13
13
|
* @param {string} src js 地址。
|
|
14
14
|
* @param {Object} [options] script 标签属性。比如 `defer` `onload` `onerror` `id` 等,下面列举部分带有默认值或额外扩展的配置。
|
|
15
|
-
* @param {boolean} [options.destroyOnError=true] 如果加载失败或错误,自动删除 dom 中的 script
|
|
15
|
+
* @param {boolean} [options.destroyOnError=true] 如果加载失败或错误,自动删除 dom 中的 script 标签。默认`true`
|
|
16
16
|
* @param {Object} [options.attrs] 自定义 script 属性,通过 script.setAttribute 设置。
|
|
17
|
-
* @param {boolean} [options.async=true]
|
|
18
|
-
* @param {string} [options.type='text/javascript']
|
|
17
|
+
* @param {boolean} [options.async=true] 异步加载。默认`true`
|
|
18
|
+
* @param {string} [options.type='text/javascript'] 类型。默认`text/javascript`
|
|
19
19
|
* @return {Promise<HTMLScriptElement>} 异步返回 script 元素。
|
|
20
20
|
* @example
|
|
21
21
|
*
|
|
@@ -17,17 +17,17 @@ type Options = {
|
|
|
17
17
|
* @static
|
|
18
18
|
* @alias module:Processor.numberToChinese
|
|
19
19
|
* @since 1.2.0
|
|
20
|
-
* @see {@link https://openstd.samr.gov.cn/bzgk/gb/newGbInfo?hcno=F5DAC3377DA99C8D78AE66735B6359C7 出版物上数字用法}
|
|
20
|
+
* @see {@link https://openstd.samr.gov.cn/bzgk/gb/newGbInfo?hcno=F5DAC3377DA99C8D78AE66735B6359C7 | 出版物上数字用法}
|
|
21
21
|
* @param {number} num 数字
|
|
22
22
|
* @param {Object} [options] 配置项
|
|
23
|
-
* @param {boolean} [options.big5=false]
|
|
24
|
-
* @param {boolean} [options.unit=true]
|
|
25
|
-
* @param {string} [options.decimal="点"]
|
|
26
|
-
* @param {string} [options.zero="零"] 设置0
|
|
27
|
-
* @param {string} [options.negative="负"]
|
|
23
|
+
* @param {boolean} [options.big5=false] 繁体,默认`false`
|
|
24
|
+
* @param {boolean} [options.unit=true] 计数单位,默认`true`
|
|
25
|
+
* @param {string} [options.decimal="点"] 中文小数点。默认`点`,当`big5=true`时,默认`點`
|
|
26
|
+
* @param {string} [options.zero="零"] 设置0,默认`零`。常用配置 〇
|
|
27
|
+
* @param {string} [options.negative="负"] 负数前面的字,默认`负`
|
|
28
28
|
* @param {Object} [options.unitConfig] 节点单位配置
|
|
29
|
-
* @param {string} [options.unitConfig.w="万"]
|
|
30
|
-
* @param {string} [options.unitConfig.y="亿"]
|
|
29
|
+
* @param {string} [options.unitConfig.w="万"] 设置计数单位万,默认`万`。常用配置 萬
|
|
30
|
+
* @param {string} [options.unitConfig.y="亿"] 设置计数单位亿,默认`亿`。常用配置 億
|
|
31
31
|
* @returns {string} 中文数字
|
|
32
32
|
* @example
|
|
33
33
|
*
|
package/types/padZero.d.ts
CHANGED
package/types/parseIdCard.d.ts
CHANGED
|
@@ -36,7 +36,7 @@ type IdCardInfo = {
|
|
|
36
36
|
* @static
|
|
37
37
|
* @alias module:Processor.parseIdCard
|
|
38
38
|
* @since 4.0.0
|
|
39
|
-
* @see {@link https://baike.baidu.com/item/居民身份证号码 居民身份证号码}
|
|
39
|
+
* @see {@link https://baike.baidu.com/item/居民身份证号码 | 居民身份证号码}
|
|
40
40
|
* @param {string} id 身份证号码,支持15位
|
|
41
41
|
* @returns {IdCardInfo | null} 省份、生日、性别,省/市/区/年/月/日/性别编码。如果解析失败将返回 null 。
|
|
42
42
|
* @example
|
package/types/randomString.d.ts
CHANGED
|
@@ -8,8 +8,8 @@ interface RandomString {
|
|
|
8
8
|
* @function
|
|
9
9
|
* @alias module:Other.randomString
|
|
10
10
|
* @since 4.8.0
|
|
11
|
-
* @param {number} [len=0]
|
|
12
|
-
* @param {'number' | 'lower' | 'upper' | string} [pool='0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ']
|
|
11
|
+
* @param {number} [len=0] 长度,默认`0`
|
|
12
|
+
* @param {'number' | 'lower' | 'upper' | string} [pool='0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'] 字符池,默认为数字和大小写字母。支持设置类型`number` `lower` `upper` 或字符串。
|
|
13
13
|
* @returns {string} 随机字符串
|
|
14
14
|
* @example
|
|
15
15
|
*
|
package/types/replaceChar.d.ts
CHANGED
|
@@ -13,9 +13,9 @@ type Options = {
|
|
|
13
13
|
* @since 1.1.0
|
|
14
14
|
* @param {string} str 要处理的字符串
|
|
15
15
|
* @param {Object} [options] 配置项
|
|
16
|
-
* @param {number} [options.start=3]
|
|
17
|
-
* @param {number} [options.end=-4]
|
|
18
|
-
* @param {string} [options.char="*"]
|
|
16
|
+
* @param {number} [options.start=3] 开始位置,默认`3`
|
|
17
|
+
* @param {number} [options.end=-4] 结束位置,默认`-4`
|
|
18
|
+
* @param {string} [options.char="*"] 替换字符,默认`*`
|
|
19
19
|
* @param {number} [options.repeat] 替换字符的重复次数,默认为替换内容长度,可设置为固定值
|
|
20
20
|
* @param {string} [options.exclude] 排除字符,如果指定排除项,repeat设置无效
|
|
21
21
|
* @returns {string} 处理后的字符
|
package/types/round.d.ts
CHANGED
package/types/safeDate.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ interface SafeDate {
|
|
|
13
13
|
* @function
|
|
14
14
|
* @alias module:Processor.safeDate
|
|
15
15
|
* @since 4.4.0
|
|
16
|
-
* @see {@link https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Date Date}
|
|
16
|
+
* @see {@link https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Date | Date}
|
|
17
17
|
* @param {string|number|Date} [value] 日期时间字符串、毫秒数、日期对象
|
|
18
18
|
* @param {...number} [args] 月/日/时/分/秒/毫秒
|
|
19
19
|
* @returns {Date} Date 实例日期对象
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
* @static
|
|
7
7
|
* @alias module:Processor.setDataURLPrefix
|
|
8
8
|
* @since 4.1.0
|
|
9
|
-
* @see {@link https://developer.mozilla.org/zh-CN/docs/Web/
|
|
10
|
-
* @see {@link https://
|
|
9
|
+
* @see {@link https://developer.mozilla.org/zh-CN/docs/Web/URI/Schemes/data | Data URLs}
|
|
10
|
+
* @see {@link https://www.iana.org/assignments/media-types/media-types.xhtml | Media Types}
|
|
11
11
|
* @param {string} data 数据本身
|
|
12
|
-
* @param {string} [mimeType="image/png"] MIME
|
|
13
|
-
* @param {boolean} [base64=true] 添加 base64
|
|
12
|
+
* @param {string} [mimeType="image/png"] MIME 类型,默认`image/png`
|
|
13
|
+
* @param {boolean} [base64=true] 添加 base64 标识,默认`true`
|
|
14
14
|
* @returns {string} DataURL 格式的字符串
|
|
15
15
|
* @example
|
|
16
16
|
*
|
|
@@ -12,7 +12,7 @@ type TransformFieldNames<D extends any, F extends Record<string, any>, C extends
|
|
|
12
12
|
* @param {Object[]} data 对象数组。如果是树结构数据,需要指定第三个参数 childrenField
|
|
13
13
|
* @param {Object} fieldNames 字段名映射
|
|
14
14
|
* @param {string} [childrenField] 子级数据字段名
|
|
15
|
-
* @param {'spread'|'self'} [nodeAssign='spread']
|
|
15
|
+
* @param {'spread'|'self'} [nodeAssign='spread'] 节点赋值方式,默认`spread`。`spread`表示使用展开运算符创建新值,`self`表示使用自身对象。
|
|
16
16
|
* @returns {Object[]}
|
|
17
17
|
* @example
|
|
18
18
|
*
|
|
@@ -15,7 +15,7 @@ interface TransformObjectValue {
|
|
|
15
15
|
* @since 4.23.0
|
|
16
16
|
* @param {Array | Object} data 要转换值的普通对象或数组
|
|
17
17
|
* @param {Function} fn 遍历普通对象或数组键值方法
|
|
18
|
-
* @param {boolean} [deep=true]
|
|
18
|
+
* @param {boolean} [deep=true] 深度遍历,检测值为普通对象或数组时递归处理。默认`true`
|
|
19
19
|
* @returns {Array | Object} 如果是普通对象或数组,返回一个新的对象或数组,否则返回自身
|
|
20
20
|
* @example
|
|
21
21
|
*
|
|
@@ -23,12 +23,12 @@ type Options = {
|
|
|
23
23
|
* @static
|
|
24
24
|
* @alias module:Validator.validatePassword
|
|
25
25
|
* @since 3.7.0
|
|
26
|
-
* @see {@link https://baike.baidu.com/item/ASCII#3 ASCII}
|
|
26
|
+
* @see {@link https://baike.baidu.com/item/ASCII#3 | ASCII}
|
|
27
27
|
* @param {string} value 要检测的值
|
|
28
28
|
* @param {Object} [options] 配置项
|
|
29
|
-
* @param {number} [options.level=2]
|
|
30
|
-
* @param {boolean} [options.ignoreCase=false]
|
|
31
|
-
* @param {string} [options.special="!@#$%^&*()-=_+[]\|{},./?<>~"]
|
|
29
|
+
* @param {number} [options.level=2] 密码强度,默认`2`。`1`-包含一种字符 `2`-包含两种字符 `3`-包含三种字符。(大写字母、小写字母、数字、特殊字符)
|
|
30
|
+
* @param {boolean} [options.ignoreCase=false] 是否忽略大小写,默认`false`。如果为`ture`,大小写字母视为一种字符
|
|
31
|
+
* @param {string} [options.special="!@#$%^&*()-=_+[]\|{},./?<>~"] 支持的特殊字符,默认`!@#$%^&*()-=_+[]\|{},./?<>~`
|
|
32
32
|
* @returns {ValidatePasswordReturn} 验证结果
|
|
33
33
|
* @example
|
|
34
34
|
*
|