util-helpers 5.1.3 → 5.2.1

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 (51) hide show
  1. package/README.md +1 -0
  2. package/dist/util-helpers.js +683 -74
  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 +1 -1
  7. package/esm/getFileType.js +3 -3
  8. package/esm/getMimeType.js +43 -0
  9. package/esm/index.js +1 -0
  10. package/esm/utils/file.util.js +1 -1
  11. package/lib/VERSION.js +1 -1
  12. package/lib/getFileType.js +3 -3
  13. package/lib/getMimeType.js +45 -0
  14. package/lib/index.js +2 -0
  15. package/lib/utils/file.util.js +1 -1
  16. package/package.json +18 -18
  17. package/types/AsyncMemo.d.ts +2 -2
  18. package/types/BlobUrl.d.ts +41 -0
  19. package/types/VERSION.d.ts +1 -2
  20. package/types/ajax.d.ts +21 -4
  21. package/types/calculateCursorPosition.d.ts +2 -2
  22. package/types/checkFileType.d.ts +2 -2
  23. package/types/compressImage.d.ts +1 -1
  24. package/types/dataURLToBlob.d.ts +1 -1
  25. package/types/download.d.ts +9 -22
  26. package/types/fileReader.d.ts +1 -1
  27. package/types/gcd.d.ts +1 -1
  28. package/types/getFileType.d.ts +12 -1
  29. package/types/getImageInfo.d.ts +13 -3
  30. package/types/getMimeType.d.ts +62 -0
  31. package/types/index.d.ts +3 -2
  32. package/types/isBankCard.d.ts +1 -1
  33. package/types/isBusinessLicense.d.ts +1 -1
  34. package/types/isChinese.d.ts +3 -3
  35. package/types/isHMCard.d.ts +1 -1
  36. package/types/isIdCard.d.ts +2 -2
  37. package/types/isPassport.d.ts +1 -1
  38. package/types/isPassword.d.ts +1 -1
  39. package/types/isSocialCreditCode.d.ts +1 -1
  40. package/types/isSwiftCode.d.ts +1 -1
  41. package/types/isTWCard.d.ts +1 -1
  42. package/types/isUrl.d.ts +1 -1
  43. package/types/isVehicle.d.ts +1 -1
  44. package/types/lcm.d.ts +1 -1
  45. package/types/loadImageWithBlob.d.ts +2 -1
  46. package/types/numberToChinese.d.ts +1 -1
  47. package/types/parseIdCard.d.ts +1 -1
  48. package/types/safeDate.d.ts +1 -1
  49. package/types/setDataURLPrefix.d.ts +2 -2
  50. package/types/utils/file.util.d.ts +0 -1
  51. package/types/validatePassword.d.ts +1 -1
@@ -8,9 +8,9 @@ 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
16
  * @param {boolean} [options.loose=false] 宽松模式,默认`false`。如果为`true`,只要包含中文就返回`true`
@@ -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
@@ -10,8 +10,8 @@ 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
17
  * @param {boolean} [options.loose=false] 宽松模式,默认`false`。如果为`true`,支持15位身份证号码
@@ -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
@@ -8,7 +8,7 @@ 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
14
  * @param {number} [options.level=2] 密码强度,默认`2`。`1`-包含一种字符 `2`-包含两种字符 `3`-包含三种字符。(大写字母、小写字母、数字、特殊字符)
@@ -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,不校验校验位。
@@ -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
@@ -7,7 +7,7 @@ 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
13
  * @param {boolean} [options.loose=false] 宽松模式,默认`false`。如果为true,表示支持一次性短期通行证
package/types/isUrl.d.ts CHANGED
@@ -4,7 +4,7 @@
4
4
  * @static
5
5
  * @alias module:Validator.isUrl
6
6
  * @since 3.4.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} 值是否为url
10
10
  * @example
@@ -4,7 +4,7 @@
4
4
  * @static
5
5
  * @alias module:Validator.isVehicle
6
6
  * @since 1.1.0
7
- * @see {@link https://baike.baidu.com/item/车牌号 车牌号}
7
+ * @see {@link https://baike.baidu.com/item/车牌号 | 车牌号}
8
8
  * @param {*} value 要检测的值
9
9
  * @returns {boolean} 值是否为车牌号
10
10
  * @example
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
@@ -20,7 +20,8 @@ import getFileBlob from './getFileBlob';
20
20
  * @example
21
21
  *
22
22
  * loadImage(file).then(({image, blob})=>{
23
- * // do something
23
+ * console.log(image, blob);
24
+ * // HTMLImageElement {} Blob {}
24
25
  * });
25
26
  *
26
27
  * loadImage('https://dummyimage.com/200x300').then(({image, blob})=>{
@@ -17,7 +17,7 @@ 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
23
  * @param {boolean} [options.big5=false] 繁体,默认`false`
@@ -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
@@ -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,8 +6,8 @@
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/HTTP/Basics_of_HTTP/Data_URIs Data URLs}
10
- * @see {@link https://mimesniff.spec.whatwg.org/#understanding-mime-types MIME types}
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
12
  * @param {string} [mimeType="image/png"] MIME 类型,默认`image/png`
13
13
  * @param {boolean} [base64=true] 添加 base64 标识,默认`true`
@@ -1,6 +1,5 @@
1
1
  export declare function testExt(name: string | undefined, ext: string): boolean;
2
2
  export type UploadFile = {
3
- uid: string;
4
3
  name: string;
5
4
  type?: string;
6
5
  url?: string;
@@ -23,7 +23,7 @@ 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
29
  * @param {number} [options.level=2] 密码强度,默认`2`。`1`-包含一种字符 `2`-包含两种字符 `3`-包含三种字符。(大写字母、小写字母、数字、特殊字符)