Skip to main content
Module

x/rimbu/mod.ts>Hasher.streamSourceHasher

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

Returns a Hasher instance that hashes any StreamSource limited to a certain amount of elements to prevent haning on infinite streams.

Examples

Example 1

const h = Hasher.streamSourceHasher()
h.hash(Stream.random())
// infinite stream but will not hang due to the max step limit

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