UNPKG

@valkyriestudios/validator

Version:

A lightweight configurable javascript validator

19 lines (18 loc) 587 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.vGreaterThan = vGreaterThan; exports.default = vGreaterThan; function vGreaterThan(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; } }