util-helpers 4.17.3 → 4.18.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 +4 -4
- package/dist/util-helpers.js +305 -186
- 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 +4 -0
- package/esm/calculateCursorPosition.js +3 -3
- package/esm/divide.js +2 -2
- package/esm/download.js +1 -2
- package/esm/filterTree.js +1 -1
- package/esm/findTreeNode.js +1 -1
- package/esm/findTreeNodes.js +1 -1
- package/esm/findTreeSelect.js +1 -1
- package/esm/formatBankCard.js +2 -2
- package/esm/formatMobile.js +2 -2
- package/esm/formatMoney.js +3 -3
- package/esm/index.js +6 -1
- package/esm/isBankCard.js +2 -2
- package/esm/isBusinessLicense.js +2 -2
- package/esm/isChinese.js +2 -2
- package/esm/isEmail.js +2 -2
- package/esm/isHMCard.js +2 -2
- package/esm/isIPv4.js +2 -2
- package/esm/isIPv6.js +2 -2
- package/esm/isIdCard.js +2 -2
- package/esm/isMobile.js +2 -2
- package/esm/isPassport.js +2 -2
- package/esm/isPostcode.js +2 -2
- package/esm/isPromiseLike.js +3 -1
- package/esm/isQQ.js +2 -2
- package/esm/isSocialCreditCode.js +2 -2
- package/esm/isSwiftCode.js +2 -2
- package/esm/isTWCard.js +2 -2
- package/esm/isTelephone.js +2 -2
- package/esm/isUrl.js +2 -2
- package/esm/isValidNumber.js +1 -1
- package/esm/isVehicle.js +2 -2
- package/esm/isWX.js +2 -2
- package/esm/listToTree.js +1 -1
- package/esm/minus.js +2 -2
- package/esm/normalizeString.js +2 -6
- package/esm/padZero.js +2 -2
- package/esm/plus.js +2 -2
- package/esm/replaceChar.js +2 -2
- package/esm/round.js +2 -2
- package/esm/strlen.js +2 -2
- package/esm/times.js +2 -2
- package/esm/transformFieldNames.js +1 -1
- package/esm/treeToList.js +1 -1
- package/esm/utils/config.js +1 -2
- package/esm/utils/math.util.js +1 -4
- package/esm/waitTime.js +3 -3
- package/lib/VERSION.js +6 -0
- package/lib/calculateCursorPosition.js +3 -3
- package/lib/divide.js +2 -2
- package/lib/download.js +4 -5
- package/lib/filterTree.js +3 -3
- package/lib/findTreeNode.js +2 -2
- package/lib/findTreeNodes.js +2 -2
- package/lib/findTreeSelect.js +2 -2
- package/lib/formatBankCard.js +2 -2
- package/lib/formatMobile.js +2 -2
- package/lib/formatMoney.js +3 -3
- package/lib/index.js +3 -5
- package/lib/isBankCard.js +2 -2
- package/lib/isBusinessLicense.js +2 -2
- package/lib/isChinese.js +2 -2
- package/lib/isEmail.js +2 -2
- package/lib/isHMCard.js +2 -2
- package/lib/isIPv4.js +2 -2
- package/lib/isIPv6.js +2 -2
- package/lib/isIdCard.js +2 -2
- package/lib/isMobile.js +2 -2
- package/lib/isPassport.js +2 -2
- package/lib/isPostcode.js +2 -2
- package/lib/isPromiseLike.js +3 -1
- package/lib/isQQ.js +2 -2
- package/lib/isSocialCreditCode.js +2 -2
- package/lib/isSwiftCode.js +2 -2
- package/lib/isTWCard.js +2 -2
- package/lib/isTelephone.js +2 -2
- package/lib/isUrl.js +2 -2
- package/lib/isValidNumber.js +2 -2
- package/lib/isVehicle.js +2 -2
- package/lib/isWX.js +2 -2
- package/lib/listToTree.js +2 -2
- package/lib/minus.js +2 -2
- package/lib/normalizeString.js +2 -6
- package/lib/padZero.js +2 -2
- package/lib/plus.js +2 -2
- package/lib/replaceChar.js +2 -2
- package/lib/round.js +2 -2
- package/lib/strlen.js +2 -2
- package/lib/times.js +2 -2
- package/lib/transformFieldNames.js +2 -2
- package/lib/treeToList.js +2 -2
- package/lib/utils/config.js +0 -1
- package/lib/utils/math.util.js +5 -8
- package/lib/waitTime.js +3 -3
- package/package.json +3 -6
- package/types/VERSION.d.ts +8 -0
- package/types/formatBankCard.d.ts +1 -1
- package/types/formatMobile.d.ts +1 -1
- package/types/index.d.ts +7 -1
- package/types/isPromiseLike.d.ts +2 -0
- package/types/normalizeString.d.ts +3 -1
- package/types/padZero.d.ts +1 -1
- package/types/replaceChar.d.ts +4 -1
- package/types/utils/config.d.ts +1 -2
- package/types/waitTime.d.ts +3 -1
- package/esm/utils/constants.js +0 -4
- package/esm/utils/convertToString.js +0 -7
- package/esm/utils/type/isBlob.js +0 -7
- package/esm/utils/type/isNaN.js +0 -7
- package/esm/utils/type/isNil.js +0 -8
- package/esm/utils/type/isNull.js +0 -5
- package/esm/utils/type/isNumber.js +0 -7
- package/esm/utils/type/isObject.js +0 -6
- package/esm/utils/type/isString.js +0 -7
- package/esm/utils/type/isSymbol.js +0 -7
- package/esm/utils/type/isType.js +0 -6
- package/esm/utils/type/isUndefined.js +0 -5
- package/lib/utils/constants.js +0 -4
- package/lib/utils/convertToString.js +0 -9
- package/lib/utils/type/isBlob.js +0 -9
- package/lib/utils/type/isNaN.js +0 -9
- package/lib/utils/type/isNil.js +0 -10
- package/lib/utils/type/isNull.js +0 -7
- package/lib/utils/type/isNumber.js +0 -9
- package/lib/utils/type/isObject.js +0 -8
- package/lib/utils/type/isString.js +0 -9
- package/lib/utils/type/isSymbol.js +0 -9
- package/lib/utils/type/isType.js +0 -8
- package/lib/utils/type/isUndefined.js +0 -7
- package/types/utils/constants.d.ts +0 -2
- package/types/utils/convertToString.d.ts +0 -8
- package/types/utils/type/index.d.ts +0 -28
- package/types/utils/type/isArguments.d.ts +0 -18
- package/types/utils/type/isArray.d.ts +0 -18
- package/types/utils/type/isArrayBuffer.d.ts +0 -21
- package/types/utils/type/isBlob.d.ts +0 -23
- package/types/utils/type/isBoolean.d.ts +0 -18
- package/types/utils/type/isDate.d.ts +0 -18
- package/types/utils/type/isError.d.ts +0 -18
- package/types/utils/type/isFunction.d.ts +0 -18
- package/types/utils/type/isMap.d.ts +0 -18
- package/types/utils/type/isNaN.d.ts +0 -18
- package/types/utils/type/isNil.d.ts +0 -11
- package/types/utils/type/isNull.d.ts +0 -18
- package/types/utils/type/isNumber.d.ts +0 -27
- package/types/utils/type/isObject.d.ts +0 -21
- package/types/utils/type/isRegExp.d.ts +0 -18
- package/types/utils/type/isSet.d.ts +0 -18
- package/types/utils/type/isString.d.ts +0 -18
- package/types/utils/type/isSymbol.d.ts +0 -18
- package/types/utils/type/isType.d.ts +0 -11
- package/types/utils/type/isUndefined.d.ts +0 -21
- package/types/utils/type/isWeakMap.d.ts +0 -18
- package/types/utils/type/isWeakSet.d.ts +0 -18
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ yarn add util-helpers
|
|
|
26
26
|
|
|
27
27
|
如果你的项目使用的是原生方式开发,可以在浏览器中使用 `script` 标签直接引入文件,并使用全局变量 `utilHelpers` 。
|
|
28
28
|
|
|
29
|
-
`npm` 包的
|
|
29
|
+
`npm` 包的 [util-helpers/dist](https://www.npmjs.com/package/util-helpers?activeTab=code) 目录下提供了 `UMD` 包 `util-helpers.js` 以及 `util-helpers.min.js`。你也可以通过 [UNPKG](https://unpkg.com/browse/util-helpers/dist/) 下载到本地进行使用。或者直接使用 [UNPKG 线上版本](https://unpkg.com/util-helpers/dist/util-helpers.min.js)<sup> _注意版本_ </sup>。
|
|
30
30
|
|
|
31
31
|
## 示例
|
|
32
32
|
|
|
@@ -56,7 +56,6 @@ formatBankCard('6228480402564890018', { spaceMark: '-' }); // 6228-4804-0256-489
|
|
|
56
56
|
- [formatMoney](https://doly-dev.github.io/util-helpers/module-Processor.html#.formatMoney) - 格式化金额
|
|
57
57
|
- [formatMobile](https://doly-dev.github.io/util-helpers/module-Processor.html#.formatMobile) - 格式化手机号码
|
|
58
58
|
- [formatBankCard](https://doly-dev.github.io/util-helpers/module-Processor.html#.formatBankCard) - 格式化银行卡
|
|
59
|
-
- [normalizeString](https://doly-dev.github.io/util-helpers/module-Processor.html#.normalizeString) - 规整化字符串,如果值为 `undefined` `null` 转为 '',如果不是字符串类型则转为字符串
|
|
60
59
|
- [numberToChinese](https://doly-dev.github.io/util-helpers/module-Processor.html#.numberToChinese) - 数字转中文数字
|
|
61
60
|
- [padZero](https://doly-dev.github.io/util-helpers/module-Processor.html#.padZero) - 前置补零
|
|
62
61
|
- [parseIdCard](https://doly-dev.github.io/util-helpers/module-Processor.html#.parseIdCard) - 解析身份证号码
|
|
@@ -87,7 +86,6 @@ formatBankCard('6228480402564890018', { spaceMark: '-' }); // 6228-4804-0256-489
|
|
|
87
86
|
- [isSwiftCode](https://doly-dev.github.io/util-helpers/module-Validator.html#.isSwiftCode) - Swift Code
|
|
88
87
|
- [isPassword](https://doly-dev.github.io/util-helpers/module-Validator.html#.isPassword) 密码强度
|
|
89
88
|
- [isPassport](https://doly-dev.github.io/util-helpers/module-Validator.html#.isPassport) - 护照号
|
|
90
|
-
- [isPromiseLike](https://doly-dev.github.io/util-helpers/module-Validator.html#.isPromiseLike) - 类似 Promise 对象
|
|
91
89
|
- [isChinese](https://doly-dev.github.io/util-helpers/module-Validator.html#.isChinese) - 中文
|
|
92
90
|
- [isIPv4](https://doly-dev.github.io/util-helpers/module-Validator.html#.isIPv4) - IPv4
|
|
93
91
|
- [isIPv6](https://doly-dev.github.io/util-helpers/module-Validator.html#.isIPv6) - IPv6
|
|
@@ -101,14 +99,15 @@ formatBankCard('6228480402564890018', { spaceMark: '-' }); // 6228-4804-0256-489
|
|
|
101
99
|
- [download](https://doly-dev.github.io/util-helpers/module-Other.html#.download) - 下载
|
|
102
100
|
- [randomString](https://doly-dev.github.io/util-helpers/module-Other.html#.randomString) - 随机字符串
|
|
103
101
|
- [strlen](https://doly-dev.github.io/util-helpers/module-Other.html#.strlen) - 字符长度
|
|
104
|
-
- [waitTime](https://doly-dev.github.io/util-helpers/module-Other.html#.waitTime) - 等待时间返回 Promise
|
|
105
102
|
|
|
106
103
|
## 精选第三方工具库
|
|
107
104
|
|
|
105
|
+
- [ut2] - 一个现代 JavaScript 实用工具库
|
|
108
106
|
- [lodash] - 封装了诸多对字符串、数组、对象等常见数据类型的处理函数
|
|
109
107
|
- [query-string] - URL 解析、序列化
|
|
110
108
|
- [qs] - URL 查询字符串解析和序列化库
|
|
111
109
|
- [js-cookie] - 一个简单,轻量级的 JavaScript API,用于处理 cookie
|
|
110
|
+
- [cache2] - 一个简单的 JavaScript 缓存管理,支持浏览器端和 node.js
|
|
112
111
|
- [store2] - 丰富了 localStorage 和 sessionStorage 功能(JSON,命名空间,扩展等)
|
|
113
112
|
- [dayjs] - 一个轻量的处理时间和日期的 JavaScript 库,和 Moment.js 的 API 设计保持完全一样
|
|
114
113
|
- [date-fns] - 提供了最全面、简单且一致的工具集,用于在浏览器和 Node.js 中操作 JavaScript 日期
|
|
@@ -122,6 +121,7 @@ formatBankCard('6228480402564890018', { spaceMark: '-' }); // 6228-4804-0256-489
|
|
|
122
121
|
- [JSZip] - 创建、读取和编辑 zip 文件
|
|
123
122
|
- [ua-parser-js] - 用于从用户代理数据中检测浏览器、引擎、操作系统、CPU 和设备类型/型号
|
|
124
123
|
|
|
124
|
+
[ut2]: https://www.npmjs.com/package/ut2
|
|
125
125
|
[lodash]: https://www.npmjs.com/package/lodash
|
|
126
126
|
[query-string]: https://www.npmjs.com/package/query-string
|
|
127
127
|
[qs]: https://www.npmjs.com/package/qs
|