Skip to main content
Module

x/rimbu/mod.ts>Hasher.arrayHasher

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

Returns a Hasher that hashes arrays of elements by sampling the array and using the given itemHasher to hash the sampled elements.

Examples

Example 1

const h = Hasher.arrayHasher()
console.log(h.hash([1, 2, 3] === h.hash([1, 3, 2])))
// => false

Type Parameters

optional
T = any

Parameters

optional
options: { itemHasher?: Hasher<T>; maxStepBits?: number; }
  • (optional) an object containing the following items:
  • itemHasher - (optional) a Hasher instance used to hash elements in the array
  • maxStepBits - (optional) the amount of bits to determine the maximum amount of array elements to process

Returns

Hasher<readonly T[]>