Skip to main content
Module

x/rimbu/typical/mod.ts>StrNum.IsPosNum

Rimbu is a TypeScript library focused on immutable, performant, and type-safe collections and other tools.
Go to Latest
type alias StrNum.IsPosNum
import { type StrNum } from "https://deno.land/x/rimbu@0.12.3/typical/mod.ts";
const { IsPosNum } = StrNum;

Returns true if the given string is a valid positive integer, false otherwise.

Examples

Example 1

IsPosNum<5> => true
IsPosNum<0> => false
IsPosNum<-5> => false

Type Parameters

N extends string
definition: N extends Str.Append<PosDigit, infer Rest> ? Str.DropWhile<Rest, Digit> extends "" ? true : false : false