ejv 1.1.9 → 1.1.11

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/src/interfaces.ts CHANGED
@@ -1,63 +1,63 @@
1
- import { DataType, ErrorType, NumberFormat, StringFormat } from './constants';
2
-
3
- // use common Scheme for multiple types
4
- export interface Scheme {
5
- // common
6
- key? : string; // can be omitted in array items
7
- type : string | string[] | DataType | DataType[];
8
- optional? : boolean; // false
9
- nullable? : boolean; // false
10
- // reverse? not?
11
-
12
- // common - number & Date (date string, Date)
13
- min? : number | string | Date;
14
- exclusiveMin? : boolean; // false
15
-
16
- max? : number | string | Date;
17
- exclusiveMax? : boolean; // false
18
-
19
- // common - number & string
20
- enum? : number[] | string[];
21
- enumReverse? : number[] | string[];
22
-
23
- // common - number & string
24
- format? : string | string[] | NumberFormat | NumberFormat[] | StringFormat | StringFormat[];
25
-
26
- // common - string & array
27
- length?: number;
28
- minLength? : number;
29
- maxLength? : number;
30
-
31
- // string
32
- pattern? : string | string[] | RegExp | RegExp[];
33
-
34
- // object
35
- properties? : Scheme[];
36
- allowNoProperty? : boolean; // true
37
-
38
- // array
39
- unique? : boolean; // false
40
- items? : string | string[] | DataType | DataType[] | Scheme | Scheme[];
41
- }
42
-
43
- export interface Options {
44
- customErrorMsg? : {
45
- [key in ErrorType]? : string;
46
- };
47
- }
48
-
49
- export interface InternalOptions extends Options {
50
- path : string[];
51
- }
52
-
53
- export class EjvError {
54
- public path : string;
55
-
56
- constructor(public type : ErrorType,
57
- public message : string,
58
- path : string[],
59
- public data : any,
60
- public errorData : any) {
61
- this.path = path.join('/');
62
- }
63
- }
1
+ import { DataType, ErrorType, NumberFormat, StringFormat } from './constants';
2
+
3
+ // use common Scheme for multiple types
4
+ export interface Scheme {
5
+ // common
6
+ key? : string; // can be omitted in array items
7
+ type : string | string[] | DataType | DataType[];
8
+ optional? : boolean; // false
9
+ nullable? : boolean; // false
10
+ // reverse? not?
11
+
12
+ // common - number & Date (date string, Date)
13
+ min? : number | string | Date;
14
+ exclusiveMin? : boolean; // false
15
+
16
+ max? : number | string | Date;
17
+ exclusiveMax? : boolean; // false
18
+
19
+ // common - number & string
20
+ enum? : number[] | string[];
21
+ enumReverse? : number[] | string[];
22
+
23
+ // common - number & string
24
+ format? : string | string[] | NumberFormat | NumberFormat[] | StringFormat | StringFormat[];
25
+
26
+ // common - string & array
27
+ length? : number;
28
+ minLength? : number;
29
+ maxLength? : number;
30
+
31
+ // string
32
+ pattern? : string | string[] | RegExp | RegExp[];
33
+
34
+ // object
35
+ properties? : Scheme[];
36
+ allowNoProperty? : boolean; // true
37
+
38
+ // array
39
+ unique? : boolean; // false
40
+ items? : string | string[] | DataType | DataType[] | Scheme | Scheme[];
41
+ }
42
+
43
+ export interface Options {
44
+ customErrorMsg? : {
45
+ [key in ErrorType]? : string;
46
+ };
47
+ }
48
+
49
+ export interface InternalOptions extends Options {
50
+ path : string[];
51
+ }
52
+
53
+ export class EjvError {
54
+ public path : string;
55
+
56
+ constructor (public type : ErrorType,
57
+ public message : string,
58
+ path : string[],
59
+ public data : any,
60
+ public errorData : any) {
61
+ this.path = path.join('/');
62
+ }
63
+ }
package/src/public_api.ts CHANGED
@@ -1,3 +1,3 @@
1
- export { ejv } from './ejv';
2
- export { DataType, NumberFormat, StringFormat, ErrorMsg, ErrorType } from './constants';
1
+ export { ejv } from './ejv';
2
+ export { DataType, NumberFormat, StringFormat, ErrorMsg, ErrorType } from './constants';
3
3
  export { EjvError, Scheme, Options } from './interfaces';