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";
/** Number type handler. Excepts any numeric value. */export const number: ITypeHandler<number> = ( { label, name, value, type }: ITypeInfo,): number => { if (isNaN(Number(value))) { throw new Error( `${label} ${name} must be of type ${type} but got: ${value}`, ); }
return parseFloat(value);};