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

Function all

packages/effect/src/Equivalence.ts:147–163  ·  view source on GitHub ↗
(collection: Iterable<Equivalence<A>>)

Source from the content-addressed store, hash-verified

145 * @since 2.0.0
146 */
147export const all = <A>(collection: Iterable<Equivalence<A>>): Equivalence<ReadonlyArray<A>> => {
148 return make((x, y) => {
149 const len = Math.min(x.length, y.length)
150
151 let collectionLength = 0
152 for (const equivalence of collection) {
153 if (collectionLength >= len) {
154 break
155 }
156 if (!equivalence(x[collectionLength], y[collectionLength])) {
157 return false
158 }
159 collectionLength++
160 }
161 return true
162 })
163}
164
165/**
166 * @category combining

Callers 2

productManyFunction · 0.70
tupleFunction · 0.70

Calls 2

equivalenceFunction · 0.85
makeFunction · 0.70

Tested by

no test coverage detected