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

x/rimbu/hashed/common/hasher.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/hashed/common/hasher.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