Skip to main content
Module

x/rimbu/mod.ts>Hasher.numberHasher

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

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

Examples

Example 1

const h = Hasher.numberHasher()
console.log(h.hash(Number.POSITIVE_INFINITY) === h.hash(Number.NEGATIVE_INFINITY))
// => false
console.log(h.hash(Number.NaN) === h.hash(Number.NaN))
// => true