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

x/rimbu/common/internal.ts>Eq.objectEq

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

Returns an Eq instance that checks equality of objects containing property values of type V by iteratively applying given valueEq to each of the object's property values.

Examples

Example 1

const eq = Eq.objectEq()
console.log(eq({ a: 1, b: { c: 2 }}, { b: { c: 2 }, a: 1 }))
// => true
console.log(eq({ a: 1, b: { c: 2 }}, { a: 1, b: { c: 3 }}))
// => false

Type Parameters

optional
V = any

Parameters

optional
valueEq: Eq<V>
  • (optional) the Eq instance to use to compare property values

Returns

Eq<Record<any, V>>