util-helpers 4.8.3 → 4.9.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.
- package/README.md +1 -1
- package/dist/util-helpers.js +42 -24
- 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/index.js +1 -0
- package/esm/isSwiftCode.js +19 -0
- package/lib/index.js +8 -0
- package/lib/isSwiftCode.js +30 -0
- package/package.json +2 -1
- package/types/index.d.ts +1 -0
- package/types/isSwiftCode.d.ts +12 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
var _convertToString = _interopRequireDefault(require("./utils/convertToString"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
+
|
|
12
|
+
var reg = /^[A-Z]{6}[A-Z\d]{2}(?:[A-Z\d]{3})?$/;
|
|
13
|
+
/**
|
|
14
|
+
* 检测值是否为 Swift Code。8位或11位,前6位为大写字母,7-8位为大写字母或数字,9-11位为可选的大写字母或数字。
|
|
15
|
+
*
|
|
16
|
+
* @static
|
|
17
|
+
* @alias module:Validator.isSwiftCode
|
|
18
|
+
* @see 参考 {@link https://zh.wikipedia.org/wiki/ISO_9362|ISO 9362}
|
|
19
|
+
* @since 4.9.0
|
|
20
|
+
* @param {*} value 要检测的值
|
|
21
|
+
* @returns {boolean} 值是否为 Swift Code
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
function isSwiftCode(value) {
|
|
25
|
+
var valueStr = (0, _convertToString["default"])(value);
|
|
26
|
+
return reg.test(valueStr);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
var _default = isSwiftCode;
|
|
30
|
+
exports["default"] = _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "util-helpers",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.9.0",
|
|
4
4
|
"description": "一个基于业务场景的工具方法库",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "esm/index.js",
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"build:dist": "rm -rf dist && rollup -c",
|
|
19
19
|
"build:doc": "npm run doc",
|
|
20
20
|
"doc": "rm -rf docs && jsdoc -c conf.json",
|
|
21
|
+
"open:doc": "open ./docs/index.html",
|
|
21
22
|
"prettier": "prettier --write 'src/**/*.js' && prettier --write 'test/**/*.js'",
|
|
22
23
|
"lint-staged": "lint-staged",
|
|
23
24
|
"lint-staged:js": "eslint --ext .js",
|
package/types/index.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export { default as validatePassword } from "./validatePassword";
|
|
|
19
19
|
export { default as isPromiseLike } from "./isPromiseLike";
|
|
20
20
|
export { default as isHMCard } from "./isHMCard";
|
|
21
21
|
export { default as isTWCard } from "./isTWCard";
|
|
22
|
+
export { default as isSwiftCode } from "./isSwiftCode";
|
|
22
23
|
export { default as formatMoney } from "./formatMoney";
|
|
23
24
|
export { default as formatBankCard } from "./formatBankCard";
|
|
24
25
|
export { default as replaceChar } from "./replaceChar";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export default isSwiftCode;
|
|
2
|
+
/**
|
|
3
|
+
* 检测值是否为 Swift Code。8位或11位,前6位为大写字母,7-8位为大写字母或数字,9-11位为可选的大写字母或数字。
|
|
4
|
+
*
|
|
5
|
+
* @static
|
|
6
|
+
* @alias module:Validator.isSwiftCode
|
|
7
|
+
* @see 参考 {@link https://zh.wikipedia.org/wiki/ISO_9362|ISO 9362}
|
|
8
|
+
* @since 4.9.0
|
|
9
|
+
* @param {*} value 要检测的值
|
|
10
|
+
* @returns {boolean} 值是否为 Swift Code
|
|
11
|
+
*/
|
|
12
|
+
declare function isSwiftCode(value: any): boolean;
|