UNPKG

@valkyriestudios/validator

Version:

A lightweight configurable javascript validator

19 lines (18 loc) 575 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.vLessThan = vLessThan; exports.default = vLessThan; function vLessThan(val, bound) { const n_bound = typeof bound === 'string' ? parseFloat(bound) : bound; if (!Number.isFinite(n_bound)) return false; if (typeof val === 'string' || Array.isArray(val)) { return val.length < n_bound; } else if (val instanceof File || val instanceof Blob) { return val.size < n_bound; } else { return Number.isFinite(val) && val < n_bound; } }