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

x/rimbu/core/mod.ts>Hasher

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

Functions

Returns a Hasher instance that hashes any value, and traverses into an object or array to hash its elements.

Returns a Hasher instance that hashes any value, but never traverses into an object or array to hash its elements. In those cases it will use toString.

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

Returns a Hasher instance that hashes any value, but only traverses into an object or array to hash its elements one level deep. After one level, it will use toString.

Returns a Hasher instance that hashes the string representation of any value

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

Returns a Hasher instance that hashes bigints.

Returns a Hasher instance that hashes booleans.

Returns a Hasher instance that hashes the .valueOf value of the given object using the given valueHasher for instances of given cls class.

Returns a Hasher instance that hashes Dates.

Returns a Hasher instance that hashes numbers, including 'special' values like NaN and infinities.

Returns a Hasher instance that hashes objects of key type K and value type V. If a value if an object or array, it will recursively hash its values.

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

Returns a Hasher instance that hashes objects of key type K and value type V. If a value if an object or array, it will convert those values to a string.

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

Returns a Hasher instance for string values.

Returns a Hasher that will return equal hash values for values in a tuple regardless of their order, and uses the given hasher function to hash the tuple elements.

interface Hasher
Re-export
import { type Hasher } from "https://deno.land/x/rimbu@0.13.1/core/mod.ts";

Interface used to hash objects for hashed collections.

Methods

isValid(obj: unknown): obj is UK

Returns true if this hasher can be applied to the given obj object.

hash(value: UK): number

Returns the 32-bit hash code for the given value.