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

Function Tuple

packages/effect/src/Predicate.ts:1459–1475  ·  view source on GitHub ↗
(
  elements: T
)

Source from the content-addressed store, hash-verified

1457 * @since 4.0.0
1458 */
1459export function Tuple<const T extends ReadonlyArray<Predicate.Any>>(
1460 elements: T
1461): [Extract<T[number], Refinement.Any>] extends [never] ? Predicate<{ readonly [I in keyof T]: Predicate.In<T[I]> }>
1462 : Refinement<
1463 { readonly [I in keyof T]: T[I] extends Refinement.Any ? Refinement.In<T[I]> : Predicate.In<T[I]> },
1464 { readonly [I in keyof T]: T[I] extends Refinement.Any ? Refinement.Out<T[I]> : Predicate.In<T[I]> }
1465 >
1466{
1467 return ((as: Array<unknown>) => {
1468 for (let i = 0; i < elements.length; i++) {
1469 if (elements[i](as[i]) === false) {
1470 return false
1471 }
1472 }
1473 return true
1474 }) as any
1475}
1476
1477/**
1478 * Creates a predicate for objects by applying predicates to named properties.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected