07:14
<annevk>
ljharb: essentially copy key-values from a map-like into this
08:23
<Ashley Claymore>
Kotlin has a similar method on their Map https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-map/put-all.html
08:26
<annevk>
Yeah, we've had some requests for this for URLSearchParams (which is a multi-map, but looks quite similar in shape) and I rather not add something without standard library precedent
08:26
<annevk>
For arrays it seems you just do push(...otherArray) but that doesn't really scale to other collections
08:42
<Ashley Claymore>
And that also doesn't scale with very large arrays as it blows engine's varargs limits
08:47
<Ashley Claymore>
That said Im more likely to concat and create a new array.
08:48
<Ashley Claymore>
For the URLSearchParams case is it explicitly for mutating the map, as opposed to creating a copy?
08:50
<Ashley Claymore>
The new Set.prototype.union for example is like a non-mutating extends (if one squints)
08:56
<annevk>
Ashley Claymore: yeah I noticed union and was wondering why it was like that
08:56
<annevk>
Ashley Claymore: URLSearchParams users would definitely want to mutate this
08:57
<annevk>
(in part because URLSearchParams can be associated with a URL and you'd want to end up mutating the URL)
21:31
<ljharb>
ljharb: essentially copy key-values from a map-like into this
that seems very useful; same for Set, WeakMap, WeakSet
23:32
<Ashley Claymore>
Could maybe follow how Kotlin name put for single putAll for multiple.
We could have map.setAll and set.addAll