effect-io-ai

Package: effect
Module: TxHashMap

TxHashMap.isNonEmpty

Checks whether the TxHashMap is non-empty.

Example (Checking for a non-empty map)

import { Effect, TxHashMap } from "effect"

const program = Effect.gen(function*() {
  const inventory = yield* TxHashMap.make(["laptop", 5])

  const hasItems = yield* TxHashMap.isNonEmpty(inventory)
  console.log(hasItems) // true

  // Clear inventory
  yield* TxHashMap.clear(inventory)
  const stillHasItems = yield* TxHashMap.isNonEmpty(inventory)
  console.log(stillHasItems) // false
})

Signature

declare const isNonEmpty: <K, V>(self: TxHashMap<K, V>) => Effect.Effect<boolean>

Source

Since v4.0.0