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.
- package/lib/validator.d.ts +8 -4
- package/lib/validator_m.d.ts +8 -4
- package/package.json +1 -1
package/lib/validator.d.ts
CHANGED
@@ -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:
|
24
|
-
rule: string | RegExp | ((v: any) => boolean);
|
25
|
-
message?: string;
|
26
|
-
})[];
|
30
|
+
rules: RuleType[];
|
27
31
|
}[]);
|
28
32
|
/**
|
29
33
|
* 进行数据验证,同时根据 type 进行数据类型转换
|
package/lib/validator_m.d.ts
CHANGED
@@ -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:
|
24
|
-
rule: string | RegExp | ((v: any) => boolean);
|
25
|
-
message?: string;
|
26
|
-
})[];
|
30
|
+
rules: RuleType[];
|
27
31
|
}[]);
|
28
32
|
/**
|
29
33
|
* 进行数据验证,同时根据 type 进行数据类型转换
|