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

x/rimbu/common/index.ts>Comp.anyFlatComp

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

Returns a Comp instance that compares any value using default comparison functions, but never recursively compares Iterables or objects. In those cases, it will use the stringComp instance.

Examples

Example 1

const c = Comp.anyFlatComp();
console.log(c.compare({ a: 1, b: 1 }, { b: 1, a: 1 }) < 0)
// => true
// First object is smaller because the objects are converted to a string with and then compares the resulting string.