Skip to main content
Module

x/rimbu/mod.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.1/mod.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>>