UNPKG

@valkyriestudios/validator

Version:

A lightweight configurable javascript validator

22 lines (21 loc) 616 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 (Number.isFinite(val)) { return val < n_bound; } else if (val instanceof File || val instanceof Blob) { return val.size < n_bound; } else { return false; } }