UNPKG

node-input-validator

Version:

validation library for nodejs, inspired by laravel.

18 lines (13 loc) 404 B
const { pathIndex } = require('../util/ObjectIndex'); const numeric = require('./numeric'); module.exports = function gte({ value, args }, v) { const [anotherField] = args; const anotherFieldValue = pathIndex(v.inputs, anotherField); if (!numeric({ value: anotherFieldValue })) { return false; } if (Number(value) >= Number(anotherFieldValue)) { return true; } return false; };