effect-io-ai

Package: effect
Module: FiberMap

FiberMap.hasUnsafe

Checks whether a key exists in the FiberMap.

Example (Checking if a key exists unsafely)

import { Effect, FiberMap } from "effect"

const program = Effect.gen(function*() {
  const map = yield* FiberMap.make<string>()

  // Add a fiber to the map
  yield* FiberMap.run(map, "task1", Effect.never)

  // Check if keys exist
  console.log(FiberMap.hasUnsafe(map, "task1")) // true
  console.log(FiberMap.hasUnsafe(map, "task2")) // false
})

Signature

declare const hasUnsafe: { <K>(key: K): <A, E>(self: FiberMap<K, A, E>) => boolean; <K, A, E>(self: FiberMap<K, A, E>, key: K): boolean; }

Source

Since v4.0.0