Skip to main content
Module

x/fun/sortable.ts>sign

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

Returns an Ordering from any number according to its relationship with 0.

Examples

Example 1

import { sign } from "./sortable.ts";

const result1 = sign(-9586); // -1
const result2 = sign(-0.005); // -1
const result3 = sign(1000); // 1
const result4 = sign(Number.NEGATIVE_INFINITY); // -1
const result5 = sign(0); // 0

Parameters

n: number