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

Function removeHash

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

Source from the content-addressed store, hash-verified

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

Callers 1

hashMap.tsFile · 0.70

Calls 2

emptyFunction · 0.70
removeMethod · 0.45

Tested by

no test coverage detected