UNPKG

class-validator-extended

Version:
16 lines (15 loc) 574 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.minBigInt = minBigInt; const is_bigint_1 = require("../../type/is-bigint"); /** * @category Predicates * @param value The value to validate. * @param minimum The minimum allowed value. */ function minBigInt(value, minimum) { if (!(typeof minimum === 'bigint' || (typeof minimum === 'number' && Number.isFinite(minimum)))) { throw new TypeError('Parameter "minimum" must be a finite number'); } return (0, is_bigint_1.isBigInt)(value) && value >= BigInt(minimum); }