util-helpers 4.15.3 → 4.16.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.
- package/README.md +6 -5
- package/dist/util-helpers.js +491 -73
- 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/ajax.js +149 -0
- package/esm/blobToDataURL.js +9 -13
- package/esm/calculateCursorPosition.js +2 -2
- package/esm/dataURLToBlob.js +7 -6
- package/esm/download.js +171 -0
- package/esm/fileReader.js +67 -0
- package/esm/index.js +6 -3
- package/esm/interface.doc.js +125 -0
- package/esm/isBankCard.js +1 -1
- package/esm/isBusinessLicense.js +1 -1
- package/esm/isChinese.js +3 -3
- package/esm/isHMCard.js +1 -1
- package/esm/isIdCard.js +2 -2
- package/esm/isPassport.js +1 -1
- package/esm/isPassword.js +2 -2
- package/esm/isSocialCreditCode.js +1 -1
- package/esm/isSwiftCode.js +1 -1
- package/esm/isTWCard.js +1 -1
- package/esm/isUrl.js +1 -1
- package/esm/isVehicle.js +1 -1
- package/esm/normalizeString.js +1 -1
- package/esm/numberToChinese.js +3 -2
- package/esm/parseIdCard.js +2 -2
- package/esm/safeDate.js +27 -10
- package/esm/setDataURLPrefix.js +2 -2
- package/esm/transformFieldNames.js +2 -3
- package/esm/utils/config.js +1 -1
- package/esm/utils/type/index.js +3 -1
- package/esm/utils/type/isArrayBuffer.js +25 -0
- package/esm/utils/type/isBlob.js +27 -0
- package/esm/validatePassword.js +1 -1
- package/lib/ajax.js +156 -0
- package/lib/blobToDataURL.js +9 -13
- package/lib/calculateCursorPosition.js +2 -2
- package/lib/dataURLToBlob.js +7 -6
- package/lib/download.js +176 -0
- package/lib/fileReader.js +74 -0
- package/lib/index.js +22 -1
- package/lib/interface.doc.js +127 -0
- package/lib/isBankCard.js +1 -1
- package/lib/isBusinessLicense.js +1 -1
- package/lib/isChinese.js +3 -3
- package/lib/isHMCard.js +1 -1
- package/lib/isIdCard.js +2 -2
- package/lib/isPassport.js +1 -1
- package/lib/isPassword.js +2 -2
- package/lib/isSocialCreditCode.js +1 -1
- package/lib/isSwiftCode.js +1 -1
- package/lib/isTWCard.js +1 -1
- package/lib/isUrl.js +1 -1
- package/lib/isVehicle.js +1 -1
- package/lib/normalizeString.js +1 -1
- package/lib/numberToChinese.js +3 -2
- package/lib/parseIdCard.js +2 -2
- package/lib/safeDate.js +28 -11
- package/lib/setDataURLPrefix.js +2 -2
- package/lib/transformFieldNames.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/type/index.js +14 -0
- package/lib/utils/type/isArrayBuffer.js +32 -0
- package/lib/utils/type/isBlob.js +34 -0
- package/lib/validatePassword.js +1 -1
- package/package.json +2 -2
- package/types/ajax.d.ts +121 -0
- package/types/blobToDataURL.d.ts +6 -2
- package/types/calculateCursorPosition.d.ts +2 -2
- package/types/dataURLToBlob.d.ts +1 -1
- package/types/download.d.ts +78 -0
- package/types/fileReader.d.ts +3 -0
- package/types/index.d.ts +4 -1
- package/types/isBankCard.d.ts +1 -1
- package/types/isBusinessLicense.d.ts +1 -1
- package/types/isChinese.d.ts +3 -3
- package/types/isHMCard.d.ts +1 -1
- package/types/isIdCard.d.ts +2 -2
- package/types/isPassport.d.ts +1 -1
- package/types/isPassword.d.ts +2 -2
- package/types/isSocialCreditCode.d.ts +1 -1
- package/types/isSwiftCode.d.ts +1 -1
- package/types/isTWCard.d.ts +1 -1
- package/types/isUrl.d.ts +1 -1
- package/types/isVehicle.d.ts +1 -1
- package/types/normalizeString.d.ts +1 -1
- package/types/numberToChinese.d.ts +3 -2
- package/types/parseIdCard.d.ts +3 -3
- package/types/safeDate.d.ts +3 -23
- package/types/setDataURLPrefix.d.ts +2 -2
- package/types/transformFieldNames.d.ts +2 -2
- package/types/utils/type/index.d.ts +21 -19
- package/types/utils/type/isArrayBuffer.d.ts +21 -0
- package/types/utils/type/isBlob.d.ts +23 -0
- package/types/validatePassword.d.ts +1 -1
- package/esm/transformFieldNames.doc.js +0 -35
- package/lib/transformFieldNames.doc.js +0 -42
- /package/esm/{transformFieldNames.type.js → interface.type.js} +0 -0
- /package/lib/{transformFieldNames.type.js → interface.type.js} +0 -0
- /package/types/{transformFieldNames.type.d.ts → interface.type.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -53,11 +53,9 @@ formatBankCard('6228480402564890018', { spaceMark: '-' }); // 6228-4804-0256-489
|
|
|
53
53
|
- [blobToDataURL](https://doly-dev.github.io/util-helpers/module-Processor.html#.blobToDataURL) - 将 Blob 或 File 对象转成 data:URL 格式的 Base64 字符串
|
|
54
54
|
- [bytesToSize](https://doly-dev.github.io/util-helpers/module-Processor.html#.bytesToSize) - 字节转换为存储单位
|
|
55
55
|
- [dataURLToBlob](https://doly-dev.github.io/util-helpers/module-Processor.html#.dataURLToBlob) - 将 DataURL 转为 Blob 对象
|
|
56
|
-
- [filterTree](https://doly-dev.github.io/util-helpers/module-Processor.html#.filterTree) - 过滤树节点
|
|
57
56
|
- [formatMoney](https://doly-dev.github.io/util-helpers/module-Processor.html#.formatMoney) - 格式化金额
|
|
58
57
|
- [formatMobile](https://doly-dev.github.io/util-helpers/module-Processor.html#.formatMobile) - 格式化手机号码
|
|
59
58
|
- [formatBankCard](https://doly-dev.github.io/util-helpers/module-Processor.html#.formatBankCard) - 格式化银行卡
|
|
60
|
-
- [listToTree](https://doly-dev.github.io/util-helpers/module-Processor.html#.listToTree) - 列表数据转树结构
|
|
61
59
|
- [normalizeString](https://doly-dev.github.io/util-helpers/module-Processor.html#.normalizeString) - 规整化字符串,如果值为 `undefined` `null` 转为 '',如果不是字符串类型则转为字符串
|
|
62
60
|
- [numberToChinese](https://doly-dev.github.io/util-helpers/module-Processor.html#.numberToChinese) - 数字转中文数字
|
|
63
61
|
- [padZero](https://doly-dev.github.io/util-helpers/module-Processor.html#.padZero) - 前置补零
|
|
@@ -65,6 +63,12 @@ formatBankCard('6228480402564890018', { spaceMark: '-' }); // 6228-4804-0256-489
|
|
|
65
63
|
- [replaceChar](https://doly-dev.github.io/util-helpers/module-Processor.html#.replaceChar) - 替换字符,应用场景如:脱敏
|
|
66
64
|
- [safeDate](https://doly-dev.github.io/util-helpers/module-Processor.html#.safeDate) - 创建一个 Date 实例,同 new Date
|
|
67
65
|
- [setDataURLPrefix](https://doly-dev.github.io/util-helpers/module-Processor.html#.setDataURLPrefix) - 设置 DataURL 前缀、MIME 类型、base64 标识
|
|
66
|
+
- 树结构数据操作
|
|
67
|
+
- [findTreeNode](https://doly-dev.github.io/util-helpers/module-Other.html#.findTreeNode) - 查找树结构数据节点
|
|
68
|
+
- [findTreeNodes](https://doly-dev.github.io/util-helpers/module-Other.html#.findTreeNodes) - 查找树结构数据多个节点
|
|
69
|
+
- [findTreeSelect](https://doly-dev.github.io/util-helpers/module-Other.html#.findTreeSelect) - 查找包含当前节点的所有父级节点
|
|
70
|
+
- [filterTree](https://doly-dev.github.io/util-helpers/module-Processor.html#.filterTree) - 过滤树节点
|
|
71
|
+
- [listToTree](https://doly-dev.github.io/util-helpers/module-Processor.html#.listToTree) - 列表数据转树结构
|
|
68
72
|
- [transformFieldNames](https://doly-dev.github.io/util-helpers/module-Processor.html#.transformFieldNames) - 转换字段名
|
|
69
73
|
- [treeToList](https://doly-dev.github.io/util-helpers/module-Processor.html#.treeToList) - 树结构转列表数据
|
|
70
74
|
- 数据验证
|
|
@@ -92,9 +96,6 @@ formatBankCard('6228480402564890018', { spaceMark: '-' }); // 6228-4804-0256-489
|
|
|
92
96
|
- [validatePassword](https://doly-dev.github.io/util-helpers/module-Validator.html#.validatePassword) - 验证密码
|
|
93
97
|
- 其他
|
|
94
98
|
- [calculateCursorPosition](https://doly-dev.github.io/util-helpers/module-Other.html#.calculateCursorPosition) - 计算光标位置
|
|
95
|
-
- [findTreeNode](https://doly-dev.github.io/util-helpers/module-Other.html#.findTreeNode) - 查找树结构数据节点
|
|
96
|
-
- [findTreeNodes](https://doly-dev.github.io/util-helpers/module-Other.html#.findTreeNodes) - 查找树结构数据多个节点
|
|
97
|
-
- [findTreeSelect](https://doly-dev.github.io/util-helpers/module-Other.html#.findTreeSelect) - 查找包含当前节点的所有父级节点
|
|
98
99
|
- [randomString](https://doly-dev.github.io/util-helpers/module-Other.html#.randomString) - 随机字符串
|
|
99
100
|
- [strlen](https://doly-dev.github.io/util-helpers/module-Other.html#.strlen) - 字符长度
|
|
100
101
|
- [waitTime](https://doly-dev.github.io/util-helpers/module-Other.html#.waitTime) - 等待时间返回 Promise
|