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

x/rimbu/common/index.ts>Eq.anyJsonEq

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

Returns an Eq instance that considers values equal their JSON.stringify values are equal.

Examples

Example 1

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