* Update the value for a key using a function.
(key: K, updater: (value: V) => V)
| 34 | * Update the value for a key using a function. |
| 35 | */ |
| 36 | update(key: K, updater: (value: V) => V): V { |
| 37 | const value = this.get(key) |
| 38 | const newValue = updater(value) |
| 39 | this.set(key, newValue) |
| 40 | return newValue |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | // JS engines have various limits on how many args can be passed to a function |