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

x/rimbu/common/mod.ts>Comp.iterableComp

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

Returns a Comp instance for Iterable objects that orders the Iterables by comparing the elements with the given itemComp Comp instance.

Examples

Example 1

const c = Comp.iterableComp();
console.log(c.compare([1, 3, 2], [1, 3, 2]))
// => 0
console.log(c.compare([1, 2, 3, 4], [1, 3, 2]) < 0)
// => true

Parameters

optional
itemComp: Comp<T>
  • (optional) the Comp instance to use to compare the Iterable's elements.

Returns

Comp<Iterable<T>>