Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

Usage

import * as fun from "https://raw.githubusercontent.com/baetheus/fun/main/number.ts";

The number module contains combinators for working with numbers.

§Variables

CombinableNumberMax

A Combinable instance for number that uses Math.max for combineenation. It contains the method combine.

CombinableNumberMin

A Combinable instance for number that uses Math.min for combineenation. It contains the method combine.

CombinableNumberProduct

A Combinable instance for number that uses multiplication for combineenation. It contains the method combine.

CombinableNumberSum

A Combinable instance for number that uses addition for combineenation. It contains the method combine.

ComparableNumber

The canonical implementation of Comparable for number. It contains the method equal.

InitializableNumberMax

A Initializable instance for number that uses Math.max for combineenation. It contains the method combine.

InitializableNumberMin

A Initializable instance for number that uses Math.min for combineenation. It contains the method combine.

InitializableNumberProduct

A Initializable instance for number that uses multiplication for combineenation. It contains the method combine.

InitializableNumberSum

A Initializable instance for number that uses addition for combineenation. It contains the method combine.

ShowableNumber

The canonical instance of Showable for number. It contains the method show.

SortableNumber

The canonical implementation of Sortable for number. It contains the method compare.

§Functions

add

Add two numbers.

compare

Compare two numbers and return true if they are equal.

divides

Return true if first evenly divides second.

initNegInf

A constant function that always returns Number.NEGATIVE_INFINITY. This is the maximum identity and is used as the init value for InitializableNumberMiximum.

initOne

A constant function that always returns 1. This is the multiplicative identity and is used as the init value for InitializableNumberProduct.

initPosInf

A constant function that always returns Number.POSITIVE_INFINITY. This is the minimum identity and is used as the init value for InitializableNumberMinimum.

initZero

A constant function that always returns 0. This is the additive identity and is used as the init value for InitializableNumberSum.

lte

Compare two numbers and return true if first is less than or equal to second.

mod

Return the positive modulus of two numbers.

multiply

Multiply two numbers.

sort

Compare two numbers and return their Ordering. 0 denotes equality, -1 denotes that first is less than second, and 1 denotes that first is greater than second.