feat:node-modules

This commit is contained in:
houjunxiang
2025-11-24 10:26:18 +08:00
parent 753766893b
commit 8a3e48d856
8825 changed files with 567399 additions and 1 deletions

View File

@@ -0,0 +1,18 @@
'use strict';
var $ = require('../internals/export');
var aMap = require('../internals/a-map');
var MapHelpers = require('../internals/map-helpers');
var get = MapHelpers.get;
var has = MapHelpers.has;
var set = MapHelpers.set;
// `Map.prototype.getOrInsert` method
// https://github.com/tc39/proposal-upsert
$({ target: 'Map', proto: true, real: true, forced: true }, {
getOrInsert: function getOrInsert(key, value) {
if (has(aMap(this), key)) return get(this, key);
set(this, key, value);
return value;
}
});