UNPKG

injektor

Version:

The simple dependency injection for Devebot

22 lines (21 loc) 424 B
"use strict"; const Ajv = require("ajv"); function Constructor(a = {}) { const b = new Ajv(Object.assign({ allErrors: true }, a.options)); this.validate = function (a, c, d) { const e = { ok: true, hasErrors: false }; const f = b.validate(c, a); if (!f) { e.ok = false; e.hasErrors = true; e.errors = b.errors; } return e; }; } module.exports = Constructor;