ziya-utils 1.0.33 → 1.0.34

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 CHANGED
@@ -1,4 +1,4 @@
1
- ### Ziya-Admin
1
+ ### Ziya-Utils
2
2
  > 一个 Javascript 常用工具库。
3
3
 
4
4
  ## 安装
package/dist/index.js CHANGED
@@ -2,4 +2,3 @@ export { downloadFile, getFileName } from './file/index.js';
2
2
  export { sleep } from './time/index.js';
3
3
  export { getElapsedTimeSince, isMillisecondTimestamp, isSecondTimestamp, isValidTimestamp } from './date/index.js';
4
4
  export { getUuid } from './security/index.js';
5
- export { RegexPatterns, RegexValidator } from './regexp/index.js';
@@ -14,20 +14,6 @@ PERFORMANCE OF THIS SOFTWARE.
14
14
  ***************************************************************************** */
15
15
  /* global Reflect, Promise, SuppressedError, Symbol */
16
16
 
17
- var extendStatics = function(d, b) {
18
- extendStatics = Object.setPrototypeOf ||
19
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
20
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
21
- return extendStatics(d, b);
22
- };
23
-
24
- function __extends(d, b) {
25
- if (typeof b !== "function" && b !== null)
26
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
27
- extendStatics(d, b);
28
- function __() { this.constructor = d; }
29
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
30
- }
31
17
 
32
18
  function __awaiter(thisArg, _arguments, P, generator) {
33
19
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
@@ -72,4 +58,4 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
72
58
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
73
59
  };
74
60
 
75
- export { __awaiter, __extends, __generator };
61
+ export { __awaiter, __generator };
@@ -1,53 +1,4 @@
1
1
  /**
2
- * 正则表达式工具模块
3
- * @module RegexUtils
2
+ * 正则表达式
4
3
  */
5
- /**
6
- * 正则表达式模式类型定义
7
- */
8
- interface IRegexPatterns {
9
- /** 手机号码正则 */
10
- readonly PHONE: RegExp;
11
- /** 邮箱地址正则 */
12
- readonly EMAIL: RegExp;
13
- /** 身份证号码正则 */
14
- readonly ID_CARD: RegExp;
15
- /** URL地址正则 */
16
- readonly URL: RegExp;
17
- /** IPv4地址正则 */
18
- readonly IPV4: RegExp;
19
- /** 强密码正则 */
20
- readonly STRONG_PASSWORD: RegExp;
21
- /** 中文字符正则 */
22
- readonly CHINESE: RegExp;
23
- }
24
- declare const RegexPatterns: IRegexPatterns;
25
- declare abstract class IRegexValidatorStatic {
26
- static isPhone: (phone: string) => boolean;
27
- static isEmail: (email: string) => boolean;
28
- static isIdCard: (idCard: string) => boolean;
29
- static isUrl: (url: string) => boolean;
30
- static isIpv4: (ip: string) => boolean;
31
- static isStrongPassword: (password: string) => boolean;
32
- static isChinese: (text: string) => boolean;
33
- }
34
- declare class RegexValidator extends IRegexValidatorStatic {
35
- static isPhone(phone: string): boolean;
36
- static isEmail(email: string): boolean;
37
- static isIdCard(idCard: string): boolean;
38
- static isUrl(url: string): boolean;
39
- static isIpv4(ip: string): boolean;
40
- static isStrongPassword(password: string): boolean;
41
- static isChinese(text: string): boolean;
42
- }
43
- /**
44
- * 默认导出类型定义
45
- */
46
- interface IRegexUtils {
47
- patterns: IRegexPatterns;
48
- validator: typeof RegexValidator;
49
- }
50
- export { RegexPatterns, RegexValidator, };
51
- export type { IRegexPatterns, IRegexUtils };
52
- declare const _default: IRegexUtils;
53
- export default _default;
4
+ export {};
package/package.json CHANGED
@@ -1,19 +1,26 @@
1
1
  {
2
2
  "name": "ziya-utils",
3
- "version": "1.0.33",
3
+ "version": "1.0.34",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "files": [
8
8
  "dist",
9
9
  "package.json",
10
- "README.md"
10
+ "README.md",
11
+ "!README.dev.md"
11
12
  ],
12
13
  "scripts": {
13
14
  "dev": "rollup -w -c --bundleConfigAsCjs",
14
- "build": "rollup -c --bundleConfigAsCjs"
15
+ "build": "rimraf dist lib && rollup -c --bundleConfigAsCjs"
15
16
  },
16
- "keywords": ["utils", "ziya", "tools", "javascript", "typescript"],
17
+ "keywords": [
18
+ "utils",
19
+ "ziya",
20
+ "tools",
21
+ "javascript",
22
+ "typescript"
23
+ ],
17
24
  "author": "glk",
18
25
  "license": "ISC",
19
26
  "description": "ziya-utils",
@@ -22,6 +29,7 @@
22
29
  "@rollup/plugin-node-resolve": "^15.1.0",
23
30
  "@rollup/plugin-strip": "^3.0.4",
24
31
  "@rollup/plugin-typescript": "^11.1.2",
32
+ "rimraf": "^6.0.1",
25
33
  "rollup": "^3.26.3",
26
34
  "rollup-plugin-copy": "^3.5.0",
27
35
  "rollup-plugin-node-externals": "5",
@@ -1,59 +0,0 @@
1
- import { __extends } from '../node_modules/tslib/tslib.es6.js';
2
-
3
- /**
4
- * 正则表达式工具模块
5
- * @module RegexUtils
6
- */
7
- // 正则表达式常量
8
- var RegexPatterns = {
9
- /** 手机号码正则 */
10
- PHONE: /^1[3-9]\d{9}$/,
11
- /** 邮箱地址正则 */
12
- EMAIL: /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/,
13
- /** 身份证号码正则(支持15位和18位) */
14
- ID_CARD: /(^\d{15}$)|(^\d{17}(\d|X|x)$)/,
15
- /** URL地址正则 */
16
- URL: /^(https?:\/\/)?([\da-z.-]+)\.([a-z.]{2,6})([/\w .-]*)*\/?$/,
17
- /** IPv4地址正则 */
18
- IPV4: /^(\d{1,3}\.){3}\d{1,3}$/,
19
- /** 强密码正则(至少8位,包含大小写字母、数字和特殊字符) */
20
- STRONG_PASSWORD: /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$/,
21
- /** 中文字符正则 */
22
- CHINESE: /^[\u4e00-\u9fa5]+$/
23
- };
24
- // 使用 `abstract class` 代替 `interface`,用于静态方法约束
25
- var IRegexValidatorStatic = /** @class */ (function () {
26
- function IRegexValidatorStatic() {
27
- }
28
- return IRegexValidatorStatic;
29
- }());
30
- var RegexValidator = /** @class */ (function (_super) {
31
- __extends(RegexValidator, _super);
32
- function RegexValidator() {
33
- return _super !== null && _super.apply(this, arguments) || this;
34
- }
35
- RegexValidator.isPhone = function (phone) {
36
- return RegexPatterns.PHONE.test(phone);
37
- };
38
- RegexValidator.isEmail = function (email) {
39
- return RegexPatterns.EMAIL.test(email);
40
- };
41
- RegexValidator.isIdCard = function (idCard) {
42
- return RegexPatterns.ID_CARD.test(idCard);
43
- };
44
- RegexValidator.isUrl = function (url) {
45
- return RegexPatterns.URL.test(url);
46
- };
47
- RegexValidator.isIpv4 = function (ip) {
48
- return RegexPatterns.IPV4.test(ip);
49
- };
50
- RegexValidator.isStrongPassword = function (password) {
51
- return RegexPatterns.STRONG_PASSWORD.test(password);
52
- };
53
- RegexValidator.isChinese = function (text) {
54
- return RegexPatterns.CHINESE.test(text);
55
- };
56
- return RegexValidator;
57
- }(IRegexValidatorStatic));
58
-
59
- export { RegexPatterns, RegexValidator };