UNPKG

djv

Version:

dynamic json-schema validator

15 lines (11 loc) 339 B
const { hasProperty } = require('../utils'); module.exports = function allOf(schema, tpl) { if (!hasProperty(schema, 'allOf')) { return; } const error = tpl.error('allOf'); const condition = schema.allOf .map(reference => `${tpl.link(reference)}(${tpl.data})`) .join(' || '); tpl(`if (${condition}) ${error}`); };