effect-io-ai

Package: effect
Module: Hash

Hash.combine

Combines two hash values into a single hash value.

When to use

Use to build a hash for a composite value by folding together hash values for its parts.

Details

Supports both direct and pipeable usage. The implementation combines two hash values with (self * 53) ^ b.

Example (Combining hash values)

import { Hash, pipe } from "effect"

// Can also be used with pipe

const hash1 = Hash.hash("hello")
const hash2 = Hash.hash("world")

// Combine two hash values
const combined = Hash.combine(hash2)(hash1)
console.log(combined)
const result = pipe(hash1, Hash.combine(hash2))

See

Signature

declare const combine: { (b: number): (self: number) => number; (self: number, b: number): number; }

Source

Since v2.0.0