UNPKG

node-input-validator

Version:

validation library for nodejs, inspired by laravel.

17 lines (12 loc) 391 B
const { pathIndex } = require('../lib/ObjectIndex'); const numeric = require('./numeric'); module.exports = async function lt(field, value, anotherField) { const anotherFieldValue = pathIndex(this.inputs, anotherField); if (!(await numeric(field, anotherFieldValue))) { return false; } if (Number(value) < Number(anotherFieldValue)) { return true; } return false; };