Skip to main content
Module

x/fun/mod.ts>number.sort

A collection of algebraic data types, lenses, and schemables based on a light weight higher kinded type implementation. Written for deno.
Go to Latest
function number.sort
import { number } from "https://deno.land/x/fun@v2.0.0-alpha.12/mod.ts";
const { sort } = number;

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.

Examples

Example 1

import * as N from "./number.ts";
import { pipe } from "./fn.ts";

const result1 = N.compare(1)(1); // 0
const result2 = N.compare(2)(1); // 1
const result3 = N.compare(1)(2); // -1

Parameters

first: number
second: number

Returns

Ordering