Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/rimbu/typical/strnum.ts>IsNatNum

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

Returns true if the given string is a valid natural number, false otherwise.

Examples

Example 1

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

Type Parameters

N extends string
definition: N extends "0" ? true : IsPosNum<N>