UNPKG

validatorshield

Version:

Universal validation (frontend + backend) with TypeScript. Includes common rules and Sequelize-backed async rules (unique, exists).

14 lines (13 loc) 395 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.max = max; function max(value, _ctx, max) { const maxNum = parseFloat(max); if (typeof value === 'number') return value <= maxNum; if (typeof value === 'string') return value.length <= maxNum; if (Array.isArray(value)) return value.length <= maxNum; return false; }