MCPcopy Create free account
hub / github.com/Effect-TS/effect / hashUnordered

Function hashUnordered

packages/effect/src/Hash.ts:469–475  ·  view source on GitHub ↗
(seed: number, iter: Iterable<A>, f: (el: A) => number)

Source from the content-addressed store, hash-verified

467export const structure = <A extends object>(o: A) => structureKeys(o, getAllObjectKeys(o))
468
469const hashUnordered = <A>(seed: number, iter: Iterable<A>, f: (el: A) => number): number => {
470 let h = seed
471 for (const element of iter) {
472 h ^= f(element)
473 }
474 return optimize(h)
475}
476
477/**
478 * Computes a hash value for an iterable by hashing all of its elements.

Callers 2

hashFunction · 0.85
structureKeysFunction · 0.85

Calls 2

optimizeFunction · 0.85
fFunction · 0.50

Tested by

no test coverage detected