UNPKG

@sapphire/framework

Version:

Discord bot framework built for advanced and amazing bots.

15 lines (13 loc) 666 B
import { Identifiers } from "../errors/Identifiers.mjs"; import { Result } from "@sapphire/result"; //#region src/lib/resolvers/integer.ts function resolveInteger(parameter, options) { const parsed = Number(parameter); if (!Number.isInteger(parsed)) return Result.err(Identifiers.ArgumentIntegerError); if (typeof options?.minimum === "number" && parsed < options.minimum) return Result.err(Identifiers.ArgumentIntegerTooSmall); if (typeof options?.maximum === "number" && parsed > options.maximum) return Result.err(Identifiers.ArgumentIntegerTooLarge); return Result.ok(parsed); } //#endregion export { resolveInteger }; //# sourceMappingURL=integer.mjs.map