ph-utils 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,8 +1,15 @@
1
+ /**
2
+ * 数据验证器
3
+ */
1
4
  interface RuleItem {
2
5
  rule: RegExp | ((v: any) => boolean);
3
6
  message: string;
4
7
  sameKey?: string;
5
8
  }
9
+ export declare type RuleType = string | RegExp | ((v: any) => boolean) | (RegExp | string | ((v: any) => boolean) | {
10
+ rule: string | RegExp | ((v: any) => boolean);
11
+ message?: string;
12
+ });
6
13
  /**
7
14
  * 数据验证器,除了进行数据验证外,还可以同时进行数据转化
8
15
  */
@@ -20,10 +27,7 @@ declare class Validator {
20
27
  constructor(schemas: {
21
28
  key: string;
22
29
  type?: string | ((v: any) => void);
23
- rules: string | RegExp | ((v: any) => boolean) | (RegExp | string | ((v: any) => boolean) | {
24
- rule: string | RegExp | ((v: any) => boolean);
25
- message?: string;
26
- })[];
30
+ rules: RuleType[];
27
31
  }[]);
28
32
  /**
29
33
  * 进行数据验证,同时根据 type 进行数据类型转换
@@ -1,8 +1,15 @@
1
+ /**
2
+ * 数据验证器
3
+ */
1
4
  interface RuleItem {
2
5
  rule: RegExp | ((v: any) => boolean);
3
6
  message: string;
4
7
  sameKey?: string;
5
8
  }
9
+ export declare type RuleType = string | RegExp | ((v: any) => boolean) | (RegExp | string | ((v: any) => boolean) | {
10
+ rule: string | RegExp | ((v: any) => boolean);
11
+ message?: string;
12
+ });
6
13
  /**
7
14
  * 数据验证器,除了进行数据验证外,还可以同时进行数据转化
8
15
  */
@@ -20,10 +27,7 @@ declare class Validator {
20
27
  constructor(schemas: {
21
28
  key: string;
22
29
  type?: string | ((v: any) => void);
23
- rules: string | RegExp | ((v: any) => boolean) | (RegExp | string | ((v: any) => boolean) | {
24
- rule: string | RegExp | ((v: any) => boolean);
25
- message?: string;
26
- })[];
30
+ rules: RuleType[];
27
31
  }[]);
28
32
  /**
29
33
  * 进行数据验证,同时根据 type 进行数据类型转换
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "module": "lib/index_m.js",
6
6
  "types": "lib/index.d.ts",
7
7
  "browser": "lib/index_m.js",
8
- "version": "0.2.5",
8
+ "version": "0.2.6",
9
9
  "repository": {
10
10
  "type": "git",
11
11
  "url": "git+https//gitee.com/towardly/ph.git",