Num.Positive
Num / Positive
Import
typescript
import { Num } from '@wollybeard/kit'
// Access via namespace
Num.Positive.someFunction()
typescript
import * as Num from '@wollybeard/kit/num'
// Access via namespace
Num.Positive.someFunction()
Functions
[F]
is
typescript
(value: unknown): boolean
Parameters:
value
- The value to check
Returns: True if value is a positive number
Type predicate to check if value is positive ( 0).
[F]
from
typescript
(value: number): Positive
Parameters:
value
- The number to convert to Positive
Returns: The value as a Positive number
Throws:
- Error if value is not positive ( 0)
Construct a Positive number. Throws if the value is not positive.
[F]
tryFrom
typescript
(value: number): Positive | null
Parameters:
value
- The number to try converting
Returns: The Positive number or null
Try to construct a Positive number. Returns null if the value is not positive.
Types
[∩]
Positive
typescript
type Positive = number & { [PositiveBrand]: true }
Positive number ( 0).
Positive numbers are all numbers greater than zero. They represent quantities, counts, and measurements in the real world.