UNPKG

@valkyriestudios/validator

Version:

A lightweight configurable javascript validator

19 lines (18 loc) 523 B
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 (Number.isFinite(val)) { return val < n_bound; } else if (val instanceof File || val instanceof Blob) { return val.size < n_bound; } else { return false; } } export { vLessThan, vLessThan as default };