ajv-json-logic
Version:
JSON Logic integration for Ajv validator
31 lines (26 loc) • 778 B
JavaScript
;
Object.defineProperty(exports, '__esModule', { value: true });
var jsonLogic$1 = require('json-logic-js');
var jsonLogic = require('../schemas/json-logic.json.cjs');
function getDef() {
return {
keyword: 'jsonLogic',
validate: function (logicRule, data) {
try {
return !!jsonLogic$1.apply(logicRule, data);
}
catch (e) {
return false;
}
},
errors: false,
metaSchema: jsonLogic.default,
};
}
// For CommonJS compatibility
if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') {
module.exports = getDef;
module.exports.default = getDef;
}
exports.default = getDef;
//# sourceMappingURL=jsonLogic.cjs.map