UNPKG

djv

Version:

dynamic json-schema validator

13 lines (9 loc) 281 B
const { hasProperty } = require('../utils'); module.exports = function not(schema, tpl) { if (!hasProperty(schema, 'not')) { return; } const condition = `${tpl.link(schema.not)}(${tpl.data})`; const error = tpl.error('not'); tpl(`if (!${condition}) ${error}`); };