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

x/rimbu/mod.ts>Hasher.objectHasher

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

Returns a Hasher instance that hashes objects of key type K and value type V.

Examples

Example 1

const h = Hasher.objectHasher()
console.log(h.hash({ a: 1, b: 2 }) === h.hash({ b: 2, a: 1 }))
// => true

Type Parameters

K extends string | number | symbol
optional
V = any

Parameters

optional
options: { keyHasher: Hasher<K>; valueHasher: Hasher<V>; }
  • (optional) an object containing:
  • keyHasher: (optional) a Hasher instance that is used to hash object keys
  • valueHasher: (optional) a Hasher instance that is used to hash object values

Returns

Hasher<Record<K, V>>