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

x/rimbu/hashed/common/hasher.ts>Hasher.tupleSymmetric

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

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.

Examples

Example 1

const h = Hasher.tupleSymmetric()
console.log(h.hash(['abc', 'def']) === h.hash(['def', 'abc']))

Parameters

optional
hasher: Hasher<T> = [UNSUPPORTED]
  • the Hasher instance to use for tuple elements

Returns

Hasher<readonly [T, T]>