Skip to content

Commit

Permalink
Use isPlainObject (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
nickevansuk authored Oct 13, 2023
1 parent e852221 commit cf7415a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"@openactive/data-model-validator": "^2.0.0",
"cache-parser": "^1.2.4",
"jsonpath": "^1.1.1",
"lodash": "^4.17.21",
"luxon": "^1.4.2",
"node-fetch": "^2.2.0"
}
Expand Down
6 changes: 3 additions & 3 deletions src/rules/page/required-property-values-rule.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const _ = require('lodash');
const {
ValidationErrorCategory,
ValidationErrorSeverity,
Expand Down Expand Up @@ -141,8 +142,7 @@ const RequiredPropertyValuesRule = class extends RpdeRule {
if (node.data.items instanceof Array) {
for (const item of node.data.items) {
if (
typeof item !== 'object'
|| item instanceof Array
!_.isPlainObject(item)
) {
invalidProps.item += 1;
}
Expand Down Expand Up @@ -172,7 +172,7 @@ const RequiredPropertyValuesRule = class extends RpdeRule {
}
if (
typeof item.data !== 'undefined'
&& (typeof item.data !== 'object' || item.data instanceof Array)
&& !_.isPlainObject(item.data)
) {
invalidProps.data += 1;
}
Expand Down

0 comments on commit cf7415a

Please sign in to comment.