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.
Files changed (102) hide show
  1. package/README.md +6 -5
  2. package/dist/util-helpers.js +491 -73
  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/ajax.js +149 -0
  7. package/esm/blobToDataURL.js +9 -13
  8. package/esm/calculateCursorPosition.js +2 -2
  9. package/esm/dataURLToBlob.js +7 -6
  10. package/esm/download.js +171 -0
  11. package/esm/fileReader.js +67 -0
  12. package/esm/index.js +6 -3
  13. package/esm/interface.doc.js +125 -0
  14. package/esm/isBankCard.js +1 -1
  15. package/esm/isBusinessLicense.js +1 -1
  16. package/esm/isChinese.js +3 -3
  17. package/esm/isHMCard.js +1 -1
  18. package/esm/isIdCard.js +2 -2
  19. package/esm/isPassport.js +1 -1
  20. package/esm/isPassword.js +2 -2
  21. package/esm/isSocialCreditCode.js +1 -1
  22. package/esm/isSwiftCode.js +1 -1
  23. package/esm/isTWCard.js +1 -1
  24. package/esm/isUrl.js +1 -1
  25. package/esm/isVehicle.js +1 -1
  26. package/esm/normalizeString.js +1 -1
  27. package/esm/numberToChinese.js +3 -2
  28. package/esm/parseIdCard.js +2 -2
  29. package/esm/safeDate.js +27 -10
  30. package/esm/setDataURLPrefix.js +2 -2
  31. package/esm/transformFieldNames.js +2 -3
  32. package/esm/utils/config.js +1 -1
  33. package/esm/utils/type/index.js +3 -1
  34. package/esm/utils/type/isArrayBuffer.js +25 -0
  35. package/esm/utils/type/isBlob.js +27 -0
  36. package/esm/validatePassword.js +1 -1
  37. package/lib/ajax.js +156 -0
  38. package/lib/blobToDataURL.js +9 -13
  39. package/lib/calculateCursorPosition.js +2 -2
  40. package/lib/dataURLToBlob.js +7 -6
  41. package/lib/download.js +176 -0
  42. package/lib/fileReader.js +74 -0
  43. package/lib/index.js +22 -1
  44. package/lib/interface.doc.js +127 -0
  45. package/lib/isBankCard.js +1 -1
  46. package/lib/isBusinessLicense.js +1 -1
  47. package/lib/isChinese.js +3 -3
  48. package/lib/isHMCard.js +1 -1
  49. package/lib/isIdCard.js +2 -2
  50. package/lib/isPassport.js +1 -1
  51. package/lib/isPassword.js +2 -2
  52. package/lib/isSocialCreditCode.js +1 -1
  53. package/lib/isSwiftCode.js +1 -1
  54. package/lib/isTWCard.js +1 -1
  55. package/lib/isUrl.js +1 -1
  56. package/lib/isVehicle.js +1 -1
  57. package/lib/normalizeString.js +1 -1
  58. package/lib/numberToChinese.js +3 -2
  59. package/lib/parseIdCard.js +2 -2
  60. package/lib/safeDate.js +28 -11
  61. package/lib/setDataURLPrefix.js +2 -2
  62. package/lib/transformFieldNames.js +1 -1
  63. package/lib/utils/config.js +1 -1
  64. package/lib/utils/type/index.js +14 -0
  65. package/lib/utils/type/isArrayBuffer.js +32 -0
  66. package/lib/utils/type/isBlob.js +34 -0
  67. package/lib/validatePassword.js +1 -1
  68. package/package.json +2 -2
  69. package/types/ajax.d.ts +121 -0
  70. package/types/blobToDataURL.d.ts +6 -2
  71. package/types/calculateCursorPosition.d.ts +2 -2
  72. package/types/dataURLToBlob.d.ts +1 -1
  73. package/types/download.d.ts +78 -0
  74. package/types/fileReader.d.ts +3 -0
  75. package/types/index.d.ts +4 -1
  76. package/types/isBankCard.d.ts +1 -1
  77. package/types/isBusinessLicense.d.ts +1 -1
  78. package/types/isChinese.d.ts +3 -3
  79. package/types/isHMCard.d.ts +1 -1
  80. package/types/isIdCard.d.ts +2 -2
  81. package/types/isPassport.d.ts +1 -1
  82. package/types/isPassword.d.ts +2 -2
  83. package/types/isSocialCreditCode.d.ts +1 -1
  84. package/types/isSwiftCode.d.ts +1 -1
  85. package/types/isTWCard.d.ts +1 -1
  86. package/types/isUrl.d.ts +1 -1
  87. package/types/isVehicle.d.ts +1 -1
  88. package/types/normalizeString.d.ts +1 -1
  89. package/types/numberToChinese.d.ts +3 -2
  90. package/types/parseIdCard.d.ts +3 -3
  91. package/types/safeDate.d.ts +3 -23
  92. package/types/setDataURLPrefix.d.ts +2 -2
  93. package/types/transformFieldNames.d.ts +2 -2
  94. package/types/utils/type/index.d.ts +21 -19
  95. package/types/utils/type/isArrayBuffer.d.ts +21 -0
  96. package/types/utils/type/isBlob.d.ts +23 -0
  97. package/types/validatePassword.d.ts +1 -1
  98. package/esm/transformFieldNames.doc.js +0 -35
  99. package/lib/transformFieldNames.doc.js +0 -42
  100. /package/esm/{transformFieldNames.type.js → interface.type.js} +0 -0
  101. /package/lib/{transformFieldNames.type.js → interface.type.js} +0 -0
  102. /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