packages/lobsang-formatter-schema/lib/validate.js
function validate (schema) {
  const ajv = new Ajv()
  try {
    const validator = ajv.compile(schema)
    return Promise.resolve(validator)
  } catch (error) {
    return Promise.reject(error)
  }
}
function validate (schema) {
  const ajv = new Ajv()
  try {
    const validator = ajv.compile(schema)
    return Promise.resolve(validator)
  } catch (error) {
    return Promise.reject(error)
  }
}
@module @lobsangnet/lobsang-formatter-matrix/validate
 
Derives a validator from a schema.

@private
@param {object} schema - The schema object to validate data against.
@returns {Promise<Function|Error>}
Promise which resolves to a validateFunction to use.
Or an Error if a validator function could not be derived.