-
-
Notifications
You must be signed in to change notification settings - Fork 112
Closed
Description
Due to
Lines 234 to 241 in b5f46cd
validate('if ((%s)) {', type !== 'object' ? types.object(name) : 'true') | |
validate('var missing = 0') | |
node.required.map(checkRequired) | |
validate('}'); | |
if (!greedy) { | |
validate('if (missing === 0) {') | |
indent++ | |
} |
If type is not an object, missing
is undefined
, which is not strict equal to 0
, and all follow-up checks (including ones intended for non-objects) are excluded.
Testcase:
const tape = require('tape')
const validator = require('is-my-json-valid')
tape('test', (t) => {
const validate = validator({ required: [], uniqueItems: true })
t.notOk(validate([1, 1]), 'required + uniqueItems')
t.end()
})
Metadata
Metadata
Assignees
Labels
No labels