effect-io-ai

Package: effect
Module: Array

Array.contains

Checks whether an array contains a value, using Equal.equivalence() for comparison.

When to use

Use to check whether an iterable contains a value using Effect’s default equality instead of providing a comparison function.

Example (Checking membership)

import { Array, pipe } from "effect"

console.log(pipe(["a", "b", "c", "d"], Array.contains("c"))) // true

See

Signature

declare const contains: { <A>(a: A): (self: Iterable<A>) => boolean; <A>(self: Iterable<A>, a: A): boolean; }

Source

Since v2.0.0