Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/fun/number.ts

A collection of algebraic data types, lenses, and schemables based on a light weight higher kinded type implementation. Written for deno.
Latest
import * as fun from "https://deno.land/x/fun@v2.0.0/number.ts";

The number module contains combinators for working with numbers.

Variables

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

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

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

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

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

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

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

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

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

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

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

Functions

Add two numbers.

Compare two numbers and return true if they are equal.

Return true if first evenly divides second.

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

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

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

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

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

Return the positive modulus of two numbers.

Multiply two numbers.

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.