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

Function removeHash

packages/effect/src/internal/hashMap.ts:1140–1162  ·  view source on GitHub ↗
(self: HashMap<K, V>, key: K, hash: number)

Source from the content-addressed store, hash-verified

1138})
1139
1140const removeHash = <K, V>(self: HashMap<K, V>, key: K, hash: number): HashMap<K, V> => {
1141 const impl = self as HashMapImpl<K, V>
1142 const removed = { value: false }
1143
1144 const edit = impl._editable ? impl._edit : NaN
1145 const newRoot = impl._root.remove(edit, 0, hash | 0, key, removed)
1146
1147 if (!removed.value) {
1148 return self
1149 }
1150
1151 if (impl._editable) {
1152 impl._root = newRoot ?? emptyNode
1153 impl._size--
1154 return self
1155 }
1156
1157 if (newRoot === undefined) {
1158 return empty()
1159 }
1160
1161 return new HashMapImpl(false, impl._edit, newRoot, impl._size - 1)
1162}
1163
1164/** @internal */
1165export const remove = dual<

Callers 1

hashMap.tsFile · 0.70

Calls 2

emptyFunction · 0.70
removeMethod · 0.65

Tested by

no test coverage detected