UNPKG

node-input-validator

Version:

validation library for nodejs, inspired by laravel.

14 lines (10 loc) 287 B
const numeric = require('./numeric'); module.exports = async function max(field, value, maxNum) { if (!(await numeric(field, maxNum))) { throw `Seed in max rule for ${field} must be a number.`; } if (Number(value) > Number(maxNum)) { return false; } return true; };