MCPcopy Index your code
hub / github.com/Effect-TS/effect / all

Function all

packages/effect/src/Predicate.ts:953–969  ·  view source on GitHub ↗
(
  collection: Iterable<Predicate<A>>
)

Source from the content-addressed store, hash-verified

951 * @see tuple for a more powerful, variadic version.
952 */
953export const all = <A>(
954 collection: Iterable<Predicate<A>>
955): Predicate<ReadonlyArray<A>> => {
956 return (as) => {
957 let collectionIndex = 0
958 for (const p of collection) {
959 if (collectionIndex >= as.length) {
960 break
961 }
962 if (p(as[collectionIndex]) === false) {
963 return false
964 }
965 collectionIndex++
966 }
967 return true
968 }
969}
970
971/**
972 * Combines a predicate for a single value and an iterable of predicates for the rest of an array.

Callers 2

productManyFunction · 0.70
tupleFunction · 0.70

Calls 1

pFunction · 0.50

Tested by

no test coverage detected