UNPKG

livr

Version:

Lightweight validator supporting Language Independent Validation Rules Specification

17 lines (13 loc) 405 B
const util = require('../../util'); function eq(allowedValue) { return (value, params, outputArr) => { if (util.isNoValue(value)) return; if (!util.isPrimitiveValue(value)) return 'FORMAT_ERROR'; if (value + '' === allowedValue + '') { outputArr.push(allowedValue); return; } return 'NOT_ALLOWED_VALUE'; }; } module.exports = eq;