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

Function getFromBucket

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

Source from the content-addressed store, hash-verified

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

Callers 1

MutableHashMap.tsFile · 0.85

Calls 4

equalsMethod · 0.80
someMethod · 0.80
setMethod · 0.65
getMethod · 0.65

Tested by

no test coverage detected