UNPKG

@frauschert/ts-guard

Version:

ts-guard is a typescript library that provides composable type guards. Its inspired by zod but focusses only on type guards and is more lightweight.

27 lines 759 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isBigInt = isBigInt; function isBigInt(constraints) { return (value) => { if (typeof value !== "bigint") { return false; } if (!constraints) { return true; } if (constraints.positive && value <= 0n) { return false; } if (constraints.negative && value >= 0n) { return false; } if (constraints.min !== undefined && value < constraints.min) { return false; } if (constraints.max !== undefined && value > constraints.max) { return false; } return true; }; } //# sourceMappingURL=isBigInt.js.map