Re Proposal: Add Map.prototype.putIfAbsent

Andrea Giammarchi andrea.giammarchi at
Fri Oct 12 16:54:33 UTC 2018

I think having both `set` and `put` would be actually awesome, we have
`substr` and `slice` as well that do slightly different things with
slightly different names and there are valid use cases/simplification for
both string methods.

AFAIK Allen mentioned it'd be awkward to have put too, but I hope others
agree it would solve most issues developers have with constants and one/off
WeakMap setups which is the most common use case with weak maps, weak sets,
and not weak counterparts.


On Fri, Oct 12, 2018 at 3:57 AM Jack Lu <jacklu at> wrote:

> It makes sense for a `put` to return the value, but it's awkward to say
> `put` when you want to get a value.
> And I'm fond of your proposal of `put`.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list