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

Function getFromBucket

packages/effect/src/MutableHashMap.ts:354–366  ·  view source on GitHub ↗
(
  self: MutableHashMap<K, V>,
  bucket: NonEmptyArray<K>,
  key: K
)

Source from the content-addressed store, hash-verified

352export const values = <K, V>(self: MutableHashMap<K, V>): Iterable<V> => self.backing.values()
353
354const getFromBucket = <K, V>(
355 self: MutableHashMap<K, V>,
356 bucket: NonEmptyArray<K>,
357 key: K
358): Option.Option<V> => {
359 for (let i = 0, len = bucket.length; i < len; i++) {
360 if (Equal.equals(key, bucket[i])) {
361 const refKey = bucket[i]
362 return Option.some(self.backing.get(refKey)!)
363 }
364 }
365 return Option.none()
366}
367
368/**
369 * Checks whether the MutableHashMap contains the specified key.

Callers 1

MutableHashMap.tsFile · 0.85

Calls 3

equalsMethod · 0.80
someMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected