From ab4e8129d5c94ff96e6c85d0d2b66a04a052b4e5 Mon Sep 17 00:00:00 2001 From: HelenHuang <LinHuang@pollex.com.tw> Date: 星期四, 09 六月 2022 15:26:15 +0800 Subject: [PATCH] TODO#139888 嚴選配對 - 文案修改 --- PAMapp/node_modules/core-js/internals/map-upsert.js | 16 ++++++++++++---- 1 files changed, 12 insertions(+), 4 deletions(-) diff --git a/PAMapp/node_modules/core-js/internals/map-upsert.js b/PAMapp/node_modules/core-js/internals/map-upsert.js index 30ebf7e..4645180 100644 --- a/PAMapp/node_modules/core-js/internals/map-upsert.js +++ b/PAMapp/node_modules/core-js/internals/map-upsert.js @@ -1,24 +1,32 @@ 'use strict'; +var global = require('../internals/global'); +var call = require('../internals/function-call'); +var aCallable = require('../internals/a-callable'); var isCallable = require('../internals/is-callable'); var anObject = require('../internals/an-object'); + +var TypeError = global.TypeError; // `Map.prototype.upsert` method // https://github.com/thumbsupep/proposal-upsert module.exports = function upsert(key, updateFn /* , insertFn */) { var map = anObject(this); + var get = aCallable(map.get); + var has = aCallable(map.has); + var set = aCallable(map.set); var insertFn = arguments.length > 2 ? arguments[2] : undefined; var value; if (!isCallable(updateFn) && !isCallable(insertFn)) { throw TypeError('At least one callback required'); } - if (map.has(key)) { - value = map.get(key); + if (call(has, map, key)) { + value = call(get, map, key); if (isCallable(updateFn)) { value = updateFn(value); - map.set(key, value); + call(set, map, key, value); } } else if (isCallable(insertFn)) { value = insertFn(); - map.set(key, value); + call(set, map, key, value); } return value; }; -- Gitblit v1.8.0