diff --git a/src/@prototypes/map.ts b/src/@prototypes/map.ts index 40d4d20d..50e85d48 100644 --- a/src/@prototypes/map.ts +++ b/src/@prototypes/map.ts @@ -1,14 +1,12 @@ Map.prototype.getOrInsert ??= function (key, defaultValue) { - const value = this.get(key); - if (value !== undefined) return value; + if (this.has(key)) return this.get(key); this.set(key, defaultValue); return defaultValue; }; Map.prototype.getOrInsertComputed ??= function (key, callback) { - const value = this.get(key); - if (value !== undefined) return value; + if (this.has(key)) return this.get(key); const defaultValue = callback(key); this.set(key, defaultValue);