Skip to main content
Module

x/rimbu/mod.ts>Comp.withNull

Rimbu is a TypeScript library focused on immutable, performant, and type-safe collections and other tools.
Go to Latest
function Comp.withNull
import { Comp } from "https://deno.land/x/rimbu@0.13.1/mod.ts";
const { withNull } = Comp;

Returns a Comp instance that extends the given comp instance with the capability to handle null values, where null is considered to be smaller than any other value, and equal to another null.

Examples

Example 1

const c = Comp.withNull(Comp.numberComp())
console.log(c.compare(null, 5) < 0)
// => true
console.log(c.compare(null, null))
// => 0

Parameters

comp: Comp<T>
  • the Comp instance to wrap

Returns

Comp<T | null>