@@ -9,7 +9,8 @@ function exampleJPV() {
9
9
const schema = {
10
10
aMap : new Map ( )
11
11
} ;
12
-
12
+ console . log ( typeof ( schema ) ) ;
13
+
13
14
console . log ( "This bad input below tricks jpv" ) ;
14
15
15
16
console . log ( " aMap: {\n badcode: \"problematic input.\",\n constructor: new Map().constructor \n }" ) ;
@@ -20,8 +21,30 @@ function exampleJPV() {
20
21
constructor : new Map . constructor
21
22
}
22
23
} ;
23
-
24
+
24
25
// jpv.validate(input, schema) should return false, but, as of 2.2.1, returns true
25
26
console . log ( "jpv.validate(input, schema) = " + jpv . validate ( input , schema ) ) ;
27
+ console . log ( input . constructor === schema . constructor ) ;
28
+
29
+ for ( const property in input . aMap ) {
30
+ console . log ( property ) ;
31
+ console . log ( "i am here" ) ;
32
+ if ( Object . prototype . hasOwnProperty . call ( input . aMap , String ( property ) ) ) {
33
+ console . log ( "now here" ) ;
34
+ console . log ( property ) ;
35
+
36
+ console . log ( Object . prototype . hasOwnProperty . call ( input . aMap , "constructor" ) ) ;
37
+ console . log ( Object . prototype . hasOwnProperty . call ( schema . aMap , "constructor" ) )
38
+
39
+ if ( ! Object . prototype . hasOwnProperty . call ( schema , String ( property ) ) ) {
40
+ console . log ( "checked schema" ) ;
41
+ }
42
+ //if ((typeof input[property] === 'object') &&
43
+ // (typeof schema[property] === 'object') &&
44
+ // (Object.keys(schema[property]).length !== 0)) {
45
+ // return (valid = iterate(value[property], pattern[property], valid, cb, options));
46
+ //}
47
+ }
48
+ }
26
49
27
50
}
0 commit comments