Skip to content

Num.NonNegative

Num / NonNegative

Import

typescript
import { Num } from '@wollybeard/kit'

// Access via namespace
Num.NonNegative.someFunction()
typescript
import * as Num from '@wollybeard/kit/num'

// Access via namespace
Num.NonNegative.someFunction()

Functions

[F] is

typescript
(value: unknown): boolean

Type predicate to check if value is non-negative (= 0).

[F] from

typescript
(value: number): NonNegative

Construct a NonNegative number. Throws if the value is negative.

[F] tryFrom

typescript
(value: number): NonNegative | null

Try to construct a NonNegative number. Returns null if the value is negative.

Types

[∩] NonNegative

typescript
type NonNegative = number & { [NonNegativeBrand]: true }

Non-negative number (= 0).