util-helpers 4.15.2 → 4.16.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.
Files changed (74) hide show
  1. package/README.md +6 -5
  2. package/dist/util-helpers.js +887 -479
  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 +8 -12
  8. package/esm/dataURLToBlob.js +6 -5
  9. package/esm/download.js +156 -0
  10. package/esm/fileReader.js +67 -0
  11. package/esm/filterTree.js +1 -1
  12. package/esm/findTreeNode.js +1 -1
  13. package/esm/findTreeNodes.js +1 -1
  14. package/esm/findTreeSelect.js +1 -1
  15. package/esm/index.js +15 -5
  16. package/esm/interface.doc.js +124 -0
  17. package/esm/{transformFieldNames.type.js → interface.type.js} +2 -4
  18. package/esm/listToTree.js +1 -1
  19. package/esm/numberToChinese.js +3 -2
  20. package/esm/parseIdCard.js +1 -1
  21. package/esm/replaceChar.js +11 -7
  22. package/esm/safeDate.js +26 -9
  23. package/esm/transformFieldNames.js +2 -3
  24. package/esm/treeToList.js +1 -1
  25. package/esm/utils/config.js +1 -1
  26. package/esm/utils/type/index.js +3 -1
  27. package/esm/utils/type/isArrayBuffer.js +25 -0
  28. package/esm/utils/type/isBlob.js +27 -0
  29. package/lib/ajax.js +156 -0
  30. package/lib/blobToDataURL.js +8 -12
  31. package/lib/dataURLToBlob.js +6 -5
  32. package/lib/download.js +161 -0
  33. package/lib/fileReader.js +74 -0
  34. package/lib/filterTree.js +1 -1
  35. package/lib/findTreeNode.js +1 -1
  36. package/lib/findTreeNodes.js +1 -1
  37. package/lib/findTreeSelect.js +1 -1
  38. package/lib/index.js +26 -5
  39. package/lib/interface.doc.js +126 -0
  40. package/lib/listToTree.js +1 -1
  41. package/lib/numberToChinese.js +3 -2
  42. package/lib/parseIdCard.js +1 -1
  43. package/lib/replaceChar.js +11 -7
  44. package/lib/safeDate.js +27 -10
  45. package/lib/transformFieldNames.js +1 -1
  46. package/lib/treeToList.js +1 -1
  47. package/lib/utils/config.js +1 -1
  48. package/lib/utils/type/index.js +14 -0
  49. package/lib/utils/type/isArrayBuffer.js +32 -0
  50. package/lib/utils/type/isBlob.js +34 -0
  51. package/package.json +2 -2
  52. package/types/ajax.d.ts +121 -0
  53. package/types/blobToDataURL.d.ts +5 -1
  54. package/types/download.d.ts +77 -0
  55. package/types/fileReader.d.ts +3 -0
  56. package/types/filterTree.d.ts +1 -1
  57. package/types/findTreeNode.d.ts +1 -1
  58. package/types/findTreeNodes.d.ts +1 -1
  59. package/types/findTreeSelect.d.ts +1 -1
  60. package/types/index.d.ts +8 -5
  61. package/types/{transformFieldNames.type.d.ts → interface.type.d.ts} +1 -1
  62. package/types/listToTree.d.ts +1 -1
  63. package/types/numberToChinese.d.ts +3 -2
  64. package/types/parseIdCard.d.ts +2 -2
  65. package/types/replaceChar.d.ts +11 -7
  66. package/types/safeDate.d.ts +3 -23
  67. package/types/transformFieldNames.d.ts +2 -2
  68. package/types/treeToList.d.ts +1 -1
  69. package/types/utils/type/index.d.ts +21 -19
  70. package/types/utils/type/isArrayBuffer.d.ts +21 -0
  71. package/types/utils/type/isBlob.d.ts +23 -0
  72. package/esm/transformFieldNames.doc.js +0 -35
  73. package/lib/transformFieldNames.doc.js +0 -42
  74. /package/lib/{transformFieldNames.type.js → interface.type.js} +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