ph-utils 0.2.6 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/validator.d.ts +6 -5
- package/lib/validator_m.d.ts +6 -5
- package/package.json +1 -1
package/lib/validator.d.ts
CHANGED
@@ -10,6 +10,11 @@ export declare type RuleType = string | RegExp | ((v: any) => boolean) | (RegExp
|
|
10
10
|
rule: string | RegExp | ((v: any) => boolean);
|
11
11
|
message?: string;
|
12
12
|
});
|
13
|
+
export interface SchemaType {
|
14
|
+
key: string;
|
15
|
+
type?: string | ((v: any) => void);
|
16
|
+
rules: RuleType[];
|
17
|
+
}
|
13
18
|
/**
|
14
19
|
* 数据验证器,除了进行数据验证外,还可以同时进行数据转化
|
15
20
|
*/
|
@@ -24,11 +29,7 @@ declare class Validator {
|
|
24
29
|
* 构造数据验证转换器
|
25
30
|
* @param schemas 配置验证转换规则
|
26
31
|
*/
|
27
|
-
constructor(schemas:
|
28
|
-
key: string;
|
29
|
-
type?: string | ((v: any) => void);
|
30
|
-
rules: RuleType[];
|
31
|
-
}[]);
|
32
|
+
constructor(schemas: SchemaType[]);
|
32
33
|
/**
|
33
34
|
* 进行数据验证,同时根据 type 进行数据类型转换
|
34
35
|
* @param data 待验证的数据
|
package/lib/validator_m.d.ts
CHANGED
@@ -10,6 +10,11 @@ export declare type RuleType = string | RegExp | ((v: any) => boolean) | (RegExp
|
|
10
10
|
rule: string | RegExp | ((v: any) => boolean);
|
11
11
|
message?: string;
|
12
12
|
});
|
13
|
+
export interface SchemaType {
|
14
|
+
key: string;
|
15
|
+
type?: string | ((v: any) => void);
|
16
|
+
rules: RuleType[];
|
17
|
+
}
|
13
18
|
/**
|
14
19
|
* 数据验证器,除了进行数据验证外,还可以同时进行数据转化
|
15
20
|
*/
|
@@ -24,11 +29,7 @@ declare class Validator {
|
|
24
29
|
* 构造数据验证转换器
|
25
30
|
* @param schemas 配置验证转换规则
|
26
31
|
*/
|
27
|
-
constructor(schemas:
|
28
|
-
key: string;
|
29
|
-
type?: string | ((v: any) => void);
|
30
|
-
rules: RuleType[];
|
31
|
-
}[]);
|
32
|
+
constructor(schemas: SchemaType[]);
|
32
33
|
/**
|
33
34
|
* 进行数据验证,同时根据 type 进行数据类型转换
|
34
35
|
* @param data 待验证的数据
|