MCPcopy
hub / github.com/Effect-TS/effect / toReadonlyArray

Function toReadonlyArray

packages/effect/src/internal/stm/tMap.ts:655–669  ·  view source on GitHub ↗
(self: TMap.TMap<K, V>)

Source from the content-addressed store, hash-verified

653 ))
654
655const toReadonlyArray = <K, V>(self: TMap.TMap<K, V>): STM.STM<ReadonlyArray<readonly [K, V]>> =>
656 core.effect<never, Array<readonly [K, V]>>((journal) => {
657 const buckets = tRef.unsafeGet(self.tBuckets, journal)
658 const capacity = buckets.chunk.length
659 const builder: Array<readonly [K, V]> = []
660 let index = 0
661 while (index < capacity) {
662 const bucket = buckets.chunk[index]
663 for (const entry of tRef.unsafeGet(bucket, journal)) {
664 builder.push(entry)
665 }
666 index = index + 1
667 }
668 return builder
669 })
670
671/** @internal */
672export const toChunk = <K, V>(self: TMap.TMap<K, V>): STM.STM<Chunk.Chunk<[K, V]>> =>

Callers 11

getEquivalenceFunction · 0.85
toJSONFunction · 0.85
[Hash.symbol]Function · 0.85
[Symbol.iterator]Function · 0.85
toArray_Function · 0.85
reverseChunkFunction · 0.85
Chunk.tsFile · 0.85
separateFunction · 0.85
dedupeFunction · 0.85
keysFunction · 0.85
tMap.tsFile · 0.85

Calls 1

unsafeGetMethod · 0.80

Tested by

no test coverage detected