File tree Expand file tree Collapse file tree 4 files changed +74
-6
lines changed
Expand file tree Collapse file tree 4 files changed +74
-6
lines changed Original file line number Diff line number Diff line change 1919# no-console: [ 2, { allow: [ warn, error ] } ]
2020 no-console : 0
2121 block-scoped-var : 2
22- complexity : [ 2, 15 ]
22+ complexity : [ 2, 18 ]
2323 curly : [ 2, multi-or-nest, consistent ]
2424 dot-location : [ 2, property ]
2525 dot-notation : 2
Original file line number Diff line number Diff line change 11language : node_js
22node_js :
3- - " 7"
43 - " 8"
5- - " 9"
64 - " 10"
5+ - " 11"
6+ - " 12"
77after_script :
88 - coveralls < coverage/lcov.info
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ module.exports = function defFunc(ajv) {
1616 if ( scalar [ k ] ) {
1717 var hash = { } ;
1818 for ( i = data . length ; i -- ; ) {
19- if ( typeof data [ i ] != 'object' ) continue ;
19+ if ( ! data [ i ] || typeof data [ i ] != 'object' ) continue ;
2020 var prop = data [ i ] [ key ] ;
2121 if ( prop && typeof prop == 'object' ) continue ;
2222 if ( typeof prop == 'string' ) prop = '"' + prop ;
@@ -25,9 +25,9 @@ module.exports = function defFunc(ajv) {
2525 }
2626 } else {
2727 for ( i = data . length ; i -- ; ) {
28- if ( typeof data [ i ] != 'object' ) continue ;
28+ if ( ! data [ i ] || typeof data [ i ] != 'object' ) continue ;
2929 for ( var j = i ; j -- ; ) {
30- if ( typeof data [ j ] == 'object' && equal ( data [ i ] [ key ] , data [ j ] [ key ] ) )
30+ if ( data [ j ] && typeof data [ j ] == 'object' && equal ( data [ i ] [ key ] , data [ j ] [ key ] ) )
3131 return false ;
3232 }
3333 }
Original file line number Diff line number Diff line change 395395 "valid" : false
396396 }
397397 ]
398+ },
399+ {
400+ "description" : " uniqueItemProperties keyword with null item(s)" ,
401+ "schema" : {
402+ "type" : " array" ,
403+ "uniqueItemProperties" : [" id" ],
404+ "items" : {
405+ "properties" : {
406+ "id" : {"type" : " integer" }
407+ }
408+ }
409+ },
410+ "tests" : [
411+ {
412+ "description" : " with all unique ids and null items is valid" ,
413+ "data" : [
414+ { "id" : 1 },
415+ { "id" : 2 },
416+ null ,
417+ null
418+ ],
419+ "valid" : true
420+ },
421+ {
422+ "description" : " with non-unique ids and null item is invalid" ,
423+ "data" : [
424+ { "id" : 1 },
425+ { "id" : 1 },
426+ null ,
427+ null
428+ ],
429+ "valid" : false
430+ }
431+ ]
432+ },
433+ {
434+ "description" : " uniqueItemProperties keyword with null item(s) and object keys" ,
435+ "schema" : {
436+ "type" : " array" ,
437+ "uniqueItemProperties" : [" id" ],
438+ "items" : {
439+ "properties" : {
440+ "id" : {"type" : " object" }
441+ }
442+ }
443+ },
444+ "tests" : [
445+ {
446+ "description" : " with all unique ids and null items is valid" ,
447+ "data" : [
448+ { "id" : {"_id" : 1 } },
449+ { "id" : {"_id" : 2 } },
450+ null ,
451+ null
452+ ],
453+ "valid" : true
454+ },
455+ {
456+ "description" : " with non-unique ids and null item is invalid" ,
457+ "data" : [
458+ { "id" : {"_id" : 1 } },
459+ { "id" : {"_id" : 1 } },
460+ null ,
461+ null
462+ ],
463+ "valid" : false
464+ }
465+ ]
398466 }
399467]
You can’t perform that action at this time.
0 commit comments