(self: HashMap<K, V>, key: K, hash: number)
| 1134 | }) |
| 1135 | |
| 1136 | const 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 */ |
| 1161 | export const remove = dual< |
no test coverage detected