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

x/rimbu/hashed/main/index.ts>Hasher.anyJsonStringHasher

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

Returns a Hasher instance that hashes any value by hashing the string resulting from applying JSON.stringify to the value.

Examples

Example 1

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

Returns

Hasher<any>