Skip to main content
Module

x/fonction/mod.ts>lte

A modern practical functional library
Latest
variable lte
import { lte } from "https://deno.land/x/fonction@v2.1.0-beta.4/mod.ts";

Returns true if the first argument is less than or equal to the second; otherwise false.

Examples

Example 1

// Number
lte(1, 2) // true
lte(2, 2) // true
lte(2, 1) // false

Example 2

// Bigint
lte(1n, 2n) // true
lte(2n, 2n) // true
lte(2n, 1n) // true

Example 3

// String
lte('a', 'z') // true
lte('a', 'a') // true
lte('z', 'a') // false

Example 4

// Boolean
lte(true, true) // true
lte(false, false) // true
lte(false, true) // true
lte(true, false) // false

Example 5

// Date
lte(new Date('2000/1/1'), new Date('2000/1/1')) // true
lte(new Date('1999/12/31'), new Date('2000/1/1')) // true
lte(new Date('2000/1/2'), new Date('2000/1/1')) // false

type

<T extends Ord>(a: T, b: T) => boolean