Skip to content

Commit

Permalink
fix: uniqueItemProperties with null items, closes #101
Browse files Browse the repository at this point in the history
  • Loading branch information
epoberezkin committed Jul 6, 2019
1 parent e4312a7 commit d30b9a3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.yml
Expand Up @@ -19,7 +19,7 @@ rules:
# no-console: [ 2, { allow: [ warn, error ] } ]
no-console: 0
block-scoped-var: 2
complexity: [ 2, 17 ]
complexity: [ 2, 18 ]
curly: [ 2, multi-or-nest, consistent ]
dot-location: [ 2, property ]
dot-notation: 2
Expand Down
6 changes: 3 additions & 3 deletions keywords/uniqueItemProperties.js
Expand Up @@ -16,7 +16,7 @@ module.exports = function defFunc(ajv) {
if (scalar[k]) {
var hash = {};
for (i = data.length; i--;) {
if (typeof data[i] != 'object') continue;
if (!data[i] || typeof data[i] != 'object') continue;
var prop = data[i][key];
if (prop && typeof prop == 'object') continue;
if (typeof prop == 'string') prop = '"' + prop;
Expand All @@ -25,9 +25,9 @@ module.exports = function defFunc(ajv) {
}
} else {
for (i = data.length; i--;) {
if (typeof data[i] != 'object') continue;
if (!data[i] || typeof data[i] != 'object') continue;
for (var j = i; j--;) {
if (typeof data[j] == 'object' && equal(data[i][key], data[j][key]))
if (data[j] && typeof data[j] == 'object' && equal(data[i][key], data[j][key]))
return false;
}
}
Expand Down

0 comments on commit d30b9a3

Please sign in to comment.