2026-04-16 14:47 UTC
@firefoxwebdevs@mastodon.social I have a memo library and I used to have a “hack” for this:
return (map.has(key) ? map : map.set(key, computeValue()).get(key);
My code is so much cleaner now:
return map.getOrInsertComputed(key, computeValue);
I love this feature 💖
Replies (1)
-
@firefoxwebdevs@mastodon.social 2026-04-16 14:48
@loucyx@mastodon.social it's such a minor improvement, yet very satisfying