Skip to main content
Module

x/cliffy/flags/types/number.ts

Command line framework for deno 🦕 Including Commandline-Interfaces, Prompts, CLI-Table, Arguments Parser and more...
Extremely Popular
Go to Latest
File
import type { ITypeHandler, ITypeInfo } from "../types.ts";import { InvalidTypeError } from "../_errors.ts";
/** Number type handler. Excepts any numeric value. */export const number: ITypeHandler<number> = (type: ITypeInfo): number => { const value = Number(type.value); if (Number.isFinite(value)) { return value; }
throw new InvalidTypeError(type);};