ph-utils 0.2.6 → 0.2.7

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.
@@ -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 待验证的数据
@@ -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/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.6",
8
+ "version": "0.2.7",
9
9
  "repository": {
10
10
  "type": "git",
11
11
  "url": "git+https//gitee.com/towardly/ph.git",