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

Function iterableWith

packages/effect/src/Hash.ts:450–456  ·  view source on GitHub ↗
(seed: number, f: (el: any) => number)

Source from the content-addressed store, hash-verified

448export const structure = <A extends object>(o: A) => structureKeys(o, getAllObjectKeys(o))
449
450const iterableWith = (seed: number, f: (el: any) => number) => (iter: Iterable<any>) => {
451 let h = seed
452 for (const element of iter) {
453 h ^= f(element)
454 }
455 return optimize(h)
456}
457
458/**
459 * Computes a hash value for an iterable by hashing all of its elements.

Callers 1

Hash.tsFile · 0.85

Calls 2

optimizeFunction · 0.85
fFunction · 0.50

Tested by

no test coverage detected