ejv 1.1.10 → 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/CHANGELOG.md +67 -67
- package/LICENSE +21 -21
- package/README-KR.md +591 -591
- package/README.md +595 -595
- package/build/constants.d.ts +104 -104
- package/build/constants.js +118 -118
- package/build/ejv.d.ts +2 -2
- package/build/ejv.js +686 -684
- package/build/ejv.js.map +1 -1
- package/build/interfaces.d.ts +38 -38
- package/build/interfaces.js +14 -14
- package/build/public_api.d.ts +3 -3
- package/build/public_api.js +13 -13
- package/build/tester.d.ts +34 -34
- package/build/tester.js +268 -268
- package/build/tester.js.map +1 -1
- package/build/util.d.ts +1 -1
- package/build/util.js +67 -65
- package/build/util.js.map +1 -1
- package/package.json +39 -39
- package/spec/common-test-runner.ts +17 -17
- package/spec/ejv.spec.ts +4634 -4634
- package/spec/testers.spec.ts +832 -832
- package/src/constants.ts +155 -155
- package/src/ejv.ts +1071 -1071
- package/src/interfaces.ts +63 -63
- package/src/public_api.ts +2 -2
- package/src/tester.ts +302 -302
- package/src/util.ts +58 -58
- package/tsconfig.json +18 -18
- package/tsconfig.spec.json +18 -18
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';
|