From 54aba110cfdea842914e8637c028e5a6172ca012 Mon Sep 17 00:00:00 2001 From: Denis Pushkarev Date: Sat, 23 Oct 2021 12:19:28 +0700 Subject: [PATCH] encapsulate some more built-ins --- packages/core-js/internals/collection-add-all.js | 3 ++- packages/core-js/internals/collection-delete-all.js | 3 ++- packages/core-js/internals/collection-from.js | 10 +++++----- packages/core-js/internals/collection-of.js | 9 ++------- packages/core-js/internals/map-emplace.js | 11 ++++++++--- packages/core-js/internals/map-upsert.js | 13 +++++++++---- packages/core-js/modules/esnext.map.filter.js | 7 ++++--- packages/core-js/modules/esnext.map.group-by.js | 8 ++++++-- packages/core-js/modules/esnext.map.includes.js | 2 +- packages/core-js/modules/esnext.map.key-by.js | 3 ++- packages/core-js/modules/esnext.map.map-keys.js | 7 ++++--- packages/core-js/modules/esnext.map.map-values.js | 7 ++++--- packages/core-js/modules/esnext.map.update.js | 12 ++++++++---- packages/core-js/modules/esnext.set.difference.js | 5 +++-- packages/core-js/modules/esnext.set.filter.js | 5 +++-- packages/core-js/modules/esnext.set.intersection.js | 5 +++-- .../core-js/modules/esnext.set.is-disjoint-from.js | 5 +++-- packages/core-js/modules/esnext.set.is-subset-of.js | 5 +++-- .../core-js/modules/esnext.set.is-superset-of.js | 5 +++-- packages/core-js/modules/esnext.set.join.js | 8 +++++--- packages/core-js/modules/esnext.set.map.js | 7 ++++--- .../modules/esnext.set.symmetric-difference.js | 5 +++-- 22 files changed, 87 insertions(+), 58 deletions(-) diff --git a/packages/core-js/internals/collection-add-all.js b/packages/core-js/internals/collection-add-all.js index 26538c753bea..e0bc4ed82eb5 100644 --- a/packages/core-js/internals/collection-add-all.js +++ b/packages/core-js/internals/collection-add-all.js @@ -1,4 +1,5 @@ 'use strict'; +var call = require('../internals/function-call'); var aCallable = require('../internals/a-callable'); var anObject = require('../internals/an-object'); @@ -7,7 +8,7 @@ module.exports = function addAll(/* ...elements */) { var set = anObject(this); var adder = aCallable(set.add); for (var k = 0, len = arguments.length; k < len; k++) { - adder.call(set, arguments[k]); + call(adder, set, arguments[k]); } return set; }; diff --git a/packages/core-js/internals/collection-delete-all.js b/packages/core-js/internals/collection-delete-all.js index e3e86a8a5ac0..dd32fc3ae311 100644 --- a/packages/core-js/internals/collection-delete-all.js +++ b/packages/core-js/internals/collection-delete-all.js @@ -1,4 +1,5 @@ 'use strict'; +var call = require('../internals/function-call'); var aCallable = require('../internals/a-callable'); var anObject = require('../internals/an-object'); @@ -9,7 +10,7 @@ module.exports = function deleteAll(/* ...elements */) { var allDeleted = true; var wasDeleted; for (var k = 0, len = arguments.length; k < len; k++) { - wasDeleted = remover.call(collection, arguments[k]); + wasDeleted = call(remover, collection, arguments[k]); allDeleted = allDeleted && wasDeleted; } return !!allDeleted; diff --git a/packages/core-js/internals/collection-from.js b/packages/core-js/internals/collection-from.js index 4ff5ee2a1305..748714b1d1e6 100644 --- a/packages/core-js/internals/collection-from.js +++ b/packages/core-js/internals/collection-from.js @@ -1,12 +1,12 @@ 'use strict'; // https://tc39.github.io/proposal-setmap-offrom/ -var uncurryThis = require('../internals/function-uncurry-this'); +var bind = require('../internals/function-bind-context'); +var call = require('../internals/function-call'); var aCallable = require('../internals/a-callable'); var aConstructor = require('../internals/a-constructor'); -var bind = require('../internals/function-bind-context'); var iterate = require('../internals/iterate'); -var push = uncurryThis([].push); +var push = [].push; module.exports = function from(source /* , mapFn, thisArg */) { var length = arguments.length; @@ -21,10 +21,10 @@ module.exports = function from(source /* , mapFn, thisArg */) { n = 0; boundFunction = bind(mapFn, length > 2 ? arguments[2] : undefined); iterate(source, function (nextItem) { - push(array, boundFunction(nextItem, n++)); + call(push, array, boundFunction(nextItem, n++)); }); } else { - iterate(source, array.push, { that: array }); + iterate(source, push, { that: array }); } return new this(array); }; diff --git a/packages/core-js/internals/collection-of.js b/packages/core-js/internals/collection-of.js index 90641d78ee2a..b4b10541ba25 100644 --- a/packages/core-js/internals/collection-of.js +++ b/packages/core-js/internals/collection-of.js @@ -1,12 +1,7 @@ 'use strict'; -var global = require('../internals/global'); - -var Array = global.Array; +var arraySlice = require('../internals/array-slice'); // https://tc39.github.io/proposal-setmap-offrom/ module.exports = function of() { - var length = arguments.length; - var A = Array(length); - while (length--) A[length] = arguments[length]; - return new this(A); + return new this(arraySlice(arguments)); }; diff --git a/packages/core-js/internals/map-emplace.js b/packages/core-js/internals/map-emplace.js index dded28cb5ff4..daf30cfa43d8 100644 --- a/packages/core-js/internals/map-emplace.js +++ b/packages/core-js/internals/map-emplace.js @@ -1,13 +1,18 @@ 'use strict'; +var call = require('../internals/function-call'); +var aCallable = require('../internals/a-callable'); var anObject = require('../internals/an-object'); // `Map.prototype.emplace` method // https://github.com/thumbsupep/proposal-upsert module.exports = function emplace(key, handler) { var map = anObject(this); - var value = (map.has(key) && 'update' in handler) - ? handler.update(map.get(key), key, map) + var get = aCallable(map.get); + var has = aCallable(map.has); + var set = aCallable(map.set); + var value = (call(has, map, key) && 'update' in handler) + ? handler.update(call(get, map, key), key, map) : handler.insert(key, map); - map.set(key, value); + call(set, map, key, value); return value; }; diff --git a/packages/core-js/internals/map-upsert.js b/packages/core-js/internals/map-upsert.js index da52eaa433d1..46451809fe30 100644 --- a/packages/core-js/internals/map-upsert.js +++ b/packages/core-js/internals/map-upsert.js @@ -1,5 +1,7 @@ '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'); @@ -9,19 +11,22 @@ var TypeError = global.TypeError; // 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; }; diff --git a/packages/core-js/modules/esnext.map.filter.js b/packages/core-js/modules/esnext.map.filter.js index ed8adcdeb6ff..884bc2a987ae 100644 --- a/packages/core-js/modules/esnext.map.filter.js +++ b/packages/core-js/modules/esnext.map.filter.js @@ -1,10 +1,11 @@ 'use strict'; -var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); +var $ = require('../internals/export'); var getBuiltIn = require('../internals/get-built-in'); +var bind = require('../internals/function-bind-context'); +var call = require('../internals/function-call'); var aCallable = require('../internals/a-callable'); var anObject = require('../internals/an-object'); -var bind = require('../internals/function-bind-context'); var speciesConstructor = require('../internals/species-constructor'); var getMapIterator = require('../internals/get-map-iterator'); var iterate = require('../internals/iterate'); @@ -19,7 +20,7 @@ $({ target: 'Map', proto: true, real: true, forced: IS_PURE }, { var newMap = new (speciesConstructor(map, getBuiltIn('Map')))(); var setter = aCallable(newMap.set); iterate(iterator, function (key, value) { - if (boundFunction(value, key, map)) setter.call(newMap, key, value); + if (boundFunction(value, key, map)) call(setter, newMap, key, value); }, { AS_ENTRIES: true, IS_ITERATOR: true }); return newMap; } diff --git a/packages/core-js/modules/esnext.map.group-by.js b/packages/core-js/modules/esnext.map.group-by.js index 70e3f3a22a06..2334a40a42e1 100644 --- a/packages/core-js/modules/esnext.map.group-by.js +++ b/packages/core-js/modules/esnext.map.group-by.js @@ -1,9 +1,13 @@ 'use strict'; var $ = require('../internals/export'); +var call = require('../internals/function-call'); +var uncurryThis = require('../internals/function-uncurry-this'); var aCallable = require('../internals/a-callable'); var getIterator = require('../internals/get-iterator'); var iterate = require('../internals/iterate'); +var push = uncurryThis([].push); + // `Map.groupBy` method // https://github.com/tc39/proposal-collection-methods $({ target: 'Map', stat: true }, { @@ -16,8 +20,8 @@ $({ target: 'Map', stat: true }, { var set = aCallable(newMap.set); iterate(iterator, function (element) { var derivedKey = keyDerivative(element); - if (!has.call(newMap, derivedKey)) set.call(newMap, derivedKey, [element]); - else get.call(newMap, derivedKey).push(element); + if (!call(has, newMap, derivedKey)) call(set, newMap, derivedKey, [element]); + else push(call(get, newMap, derivedKey), element); }, { IS_ITERATOR: true }); return newMap; } diff --git a/packages/core-js/modules/esnext.map.includes.js b/packages/core-js/modules/esnext.map.includes.js index cf088b8165a5..708f040b3ffa 100644 --- a/packages/core-js/modules/esnext.map.includes.js +++ b/packages/core-js/modules/esnext.map.includes.js @@ -1,6 +1,6 @@ 'use strict'; -var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); +var $ = require('../internals/export'); var anObject = require('../internals/an-object'); var getMapIterator = require('../internals/get-map-iterator'); var sameValueZero = require('../internals/same-value-zero'); diff --git a/packages/core-js/modules/esnext.map.key-by.js b/packages/core-js/modules/esnext.map.key-by.js index 8e6596569e84..174b7b7ad5b0 100644 --- a/packages/core-js/modules/esnext.map.key-by.js +++ b/packages/core-js/modules/esnext.map.key-by.js @@ -1,5 +1,6 @@ 'use strict'; var $ = require('../internals/export'); +var call = require('../internals/function-call'); var iterate = require('../internals/iterate'); var aCallable = require('../internals/a-callable'); @@ -11,7 +12,7 @@ $({ target: 'Map', stat: true }, { aCallable(keyDerivative); var setter = aCallable(newMap.set); iterate(iterable, function (element) { - setter.call(newMap, keyDerivative(element), element); + call(setter, newMap, keyDerivative(element), element); }); return newMap; } diff --git a/packages/core-js/modules/esnext.map.map-keys.js b/packages/core-js/modules/esnext.map.map-keys.js index 8e698519373a..1cebb4e50eec 100644 --- a/packages/core-js/modules/esnext.map.map-keys.js +++ b/packages/core-js/modules/esnext.map.map-keys.js @@ -1,10 +1,11 @@ 'use strict'; -var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); +var $ = require('../internals/export'); var getBuiltIn = require('../internals/get-built-in'); +var bind = require('../internals/function-bind-context'); +var call = require('../internals/function-call'); var aCallable = require('../internals/a-callable'); var anObject = require('../internals/an-object'); -var bind = require('../internals/function-bind-context'); var speciesConstructor = require('../internals/species-constructor'); var getMapIterator = require('../internals/get-map-iterator'); var iterate = require('../internals/iterate'); @@ -19,7 +20,7 @@ $({ target: 'Map', proto: true, real: true, forced: IS_PURE }, { var newMap = new (speciesConstructor(map, getBuiltIn('Map')))(); var setter = aCallable(newMap.set); iterate(iterator, function (key, value) { - setter.call(newMap, boundFunction(value, key, map), value); + call(setter, newMap, boundFunction(value, key, map), value); }, { AS_ENTRIES: true, IS_ITERATOR: true }); return newMap; } diff --git a/packages/core-js/modules/esnext.map.map-values.js b/packages/core-js/modules/esnext.map.map-values.js index 8e67a729033e..d808b8ffed93 100644 --- a/packages/core-js/modules/esnext.map.map-values.js +++ b/packages/core-js/modules/esnext.map.map-values.js @@ -1,10 +1,11 @@ 'use strict'; -var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); +var $ = require('../internals/export'); var getBuiltIn = require('../internals/get-built-in'); +var bind = require('../internals/function-bind-context'); +var call = require('../internals/function-call'); var aCallable = require('../internals/a-callable'); var anObject = require('../internals/an-object'); -var bind = require('../internals/function-bind-context'); var speciesConstructor = require('../internals/species-constructor'); var getMapIterator = require('../internals/get-map-iterator'); var iterate = require('../internals/iterate'); @@ -19,7 +20,7 @@ $({ target: 'Map', proto: true, real: true, forced: IS_PURE }, { var newMap = new (speciesConstructor(map, getBuiltIn('Map')))(); var setter = aCallable(newMap.set); iterate(iterator, function (key, value) { - setter.call(newMap, key, boundFunction(value, key, map)); + call(setter, newMap, key, boundFunction(value, key, map)); }, { AS_ENTRIES: true, IS_ITERATOR: true }); return newMap; } diff --git a/packages/core-js/modules/esnext.map.update.js b/packages/core-js/modules/esnext.map.update.js index c3e0c44858e3..f009327b9590 100644 --- a/packages/core-js/modules/esnext.map.update.js +++ b/packages/core-js/modules/esnext.map.update.js @@ -1,7 +1,8 @@ 'use strict'; +var IS_PURE = require('../internals/is-pure'); var $ = require('../internals/export'); var global = require('../internals/global'); -var IS_PURE = require('../internals/is-pure'); +var call = require('../internals/function-call'); var anObject = require('../internals/an-object'); var aCallable = require('../internals/a-callable'); @@ -12,14 +13,17 @@ var TypeError = global.TypeError; $({ target: 'Map', proto: true, real: true, forced: IS_PURE }, { update: function update(key, callback /* , thunk */) { var map = anObject(this); + var get = aCallable(map.get); + var has = aCallable(map.has); + var set = aCallable(map.set); var length = arguments.length; aCallable(callback); - var isPresentInMap = map.has(key); + var isPresentInMap = call(has, map, key); if (!isPresentInMap && length < 3) { throw TypeError('Updating absent value'); } - var value = isPresentInMap ? map.get(key) : aCallable(length > 2 ? arguments[2] : undefined)(key, map); - map.set(key, callback(value, key, map)); + var value = isPresentInMap ? call(get, map, key) : aCallable(length > 2 ? arguments[2] : undefined)(key, map); + call(set, map, key, callback(value, key, map)); return map; } }); diff --git a/packages/core-js/modules/esnext.set.difference.js b/packages/core-js/modules/esnext.set.difference.js index e9709daa6cac..5810fc34610a 100644 --- a/packages/core-js/modules/esnext.set.difference.js +++ b/packages/core-js/modules/esnext.set.difference.js @@ -1,7 +1,8 @@ 'use strict'; -var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); +var $ = require('../internals/export'); var getBuiltIn = require('../internals/get-built-in'); +var call = require('../internals/function-call'); var aCallable = require('../internals/a-callable'); var anObject = require('../internals/an-object'); var speciesConstructor = require('../internals/species-constructor'); @@ -15,7 +16,7 @@ $({ target: 'Set', proto: true, real: true, forced: IS_PURE }, { var newSet = new (speciesConstructor(set, getBuiltIn('Set')))(set); var remover = aCallable(newSet['delete']); iterate(iterable, function (value) { - remover.call(newSet, value); + call(remover, newSet, value); }); return newSet; } diff --git a/packages/core-js/modules/esnext.set.filter.js b/packages/core-js/modules/esnext.set.filter.js index e645086b15e1..1d1c353e90c2 100644 --- a/packages/core-js/modules/esnext.set.filter.js +++ b/packages/core-js/modules/esnext.set.filter.js @@ -1,7 +1,8 @@ 'use strict'; -var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); +var $ = require('../internals/export'); var getBuiltIn = require('../internals/get-built-in'); +var call = require('../internals/function-call'); var aCallable = require('../internals/a-callable'); var anObject = require('../internals/an-object'); var bind = require('../internals/function-bind-context'); @@ -19,7 +20,7 @@ $({ target: 'Set', proto: true, real: true, forced: IS_PURE }, { var newSet = new (speciesConstructor(set, getBuiltIn('Set')))(); var adder = aCallable(newSet.add); iterate(iterator, function (value) { - if (boundFunction(value, value, set)) adder.call(newSet, value); + if (boundFunction(value, value, set)) call(adder, newSet, value); }, { IS_ITERATOR: true }); return newSet; } diff --git a/packages/core-js/modules/esnext.set.intersection.js b/packages/core-js/modules/esnext.set.intersection.js index 231de95007af..be832f378311 100644 --- a/packages/core-js/modules/esnext.set.intersection.js +++ b/packages/core-js/modules/esnext.set.intersection.js @@ -1,7 +1,8 @@ 'use strict'; -var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); +var $ = require('../internals/export'); var getBuiltIn = require('../internals/get-built-in'); +var call = require('../internals/function-call'); var aCallable = require('../internals/a-callable'); var anObject = require('../internals/an-object'); var speciesConstructor = require('../internals/species-constructor'); @@ -16,7 +17,7 @@ $({ target: 'Set', proto: true, real: true, forced: IS_PURE }, { var hasCheck = aCallable(set.has); var adder = aCallable(newSet.add); iterate(iterable, function (value) { - if (hasCheck.call(set, value)) adder.call(newSet, value); + if (call(hasCheck, set, value)) call(adder, newSet, value); }); return newSet; } diff --git a/packages/core-js/modules/esnext.set.is-disjoint-from.js b/packages/core-js/modules/esnext.set.is-disjoint-from.js index 5244ad79cfd1..70d79e44bb95 100644 --- a/packages/core-js/modules/esnext.set.is-disjoint-from.js +++ b/packages/core-js/modules/esnext.set.is-disjoint-from.js @@ -1,6 +1,7 @@ 'use strict'; -var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); +var $ = require('../internals/export'); +var call = require('../internals/function-call'); var aCallable = require('../internals/a-callable'); var anObject = require('../internals/an-object'); var iterate = require('../internals/iterate'); @@ -12,7 +13,7 @@ $({ target: 'Set', proto: true, real: true, forced: IS_PURE }, { var set = anObject(this); var hasCheck = aCallable(set.has); return !iterate(iterable, function (value, stop) { - if (hasCheck.call(set, value) === true) return stop(); + if (call(hasCheck, set, value) === true) return stop(); }, { INTERRUPTED: true }).stopped; } }); diff --git a/packages/core-js/modules/esnext.set.is-subset-of.js b/packages/core-js/modules/esnext.set.is-subset-of.js index 5baabd86b509..f294824610c2 100644 --- a/packages/core-js/modules/esnext.set.is-subset-of.js +++ b/packages/core-js/modules/esnext.set.is-subset-of.js @@ -1,7 +1,8 @@ 'use strict'; -var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); +var $ = require('../internals/export'); var getBuiltIn = require('../internals/get-built-in'); +var call = require('../internals/function-call'); var aCallable = require('../internals/a-callable'); var isCallable = require('../internals/is-callable'); var anObject = require('../internals/an-object'); @@ -20,7 +21,7 @@ $({ target: 'Set', proto: true, real: true, forced: IS_PURE }, { hasCheck = aCallable(otherSet.has); } return !iterate(iterator, function (value, stop) { - if (hasCheck.call(otherSet, value) === false) return stop(); + if (call(hasCheck, otherSet, value) === false) return stop(); }, { IS_ITERATOR: true, INTERRUPTED: true }).stopped; } }); diff --git a/packages/core-js/modules/esnext.set.is-superset-of.js b/packages/core-js/modules/esnext.set.is-superset-of.js index 6c1edde7767c..86e7d4b4a4d3 100644 --- a/packages/core-js/modules/esnext.set.is-superset-of.js +++ b/packages/core-js/modules/esnext.set.is-superset-of.js @@ -1,6 +1,7 @@ 'use strict'; -var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); +var $ = require('../internals/export'); +var call = require('../internals/function-call'); var aCallable = require('../internals/a-callable'); var anObject = require('../internals/an-object'); var iterate = require('../internals/iterate'); @@ -12,7 +13,7 @@ $({ target: 'Set', proto: true, real: true, forced: IS_PURE }, { var set = anObject(this); var hasCheck = aCallable(set.has); return !iterate(iterable, function (value, stop) { - if (hasCheck.call(set, value) === false) return stop(); + if (call(hasCheck, set, value) === false) return stop(); }, { INTERRUPTED: true }).stopped; } }); diff --git a/packages/core-js/modules/esnext.set.join.js b/packages/core-js/modules/esnext.set.join.js index d5988426b79c..c996a1dbe009 100644 --- a/packages/core-js/modules/esnext.set.join.js +++ b/packages/core-js/modules/esnext.set.join.js @@ -1,12 +1,14 @@ 'use strict'; +var IS_PURE = require('../internals/is-pure'); var $ = require('../internals/export'); var uncurryThis = require('../internals/function-uncurry-this'); -var IS_PURE = require('../internals/is-pure'); var anObject = require('../internals/an-object'); +var toString = require('../internals/to-string'); var getSetIterator = require('../internals/get-set-iterator'); var iterate = require('../internals/iterate'); var arrayJoin = uncurryThis([].join); +var push = [].push; // `Set.prototype.join` method // https://github.com/tc39/proposal-collection-methods @@ -14,9 +16,9 @@ $({ target: 'Set', proto: true, real: true, forced: IS_PURE }, { join: function join(separator) { var set = anObject(this); var iterator = getSetIterator(set); - var sep = separator === undefined ? ',' : String(separator); + var sep = separator === undefined ? ',' : toString(separator); var result = []; - iterate(iterator, result.push, { that: result, IS_ITERATOR: true }); + iterate(iterator, push, { that: result, IS_ITERATOR: true }); return arrayJoin(result, sep); } }); diff --git a/packages/core-js/modules/esnext.set.map.js b/packages/core-js/modules/esnext.set.map.js index 727d0220764e..04e545479760 100644 --- a/packages/core-js/modules/esnext.set.map.js +++ b/packages/core-js/modules/esnext.set.map.js @@ -1,10 +1,11 @@ 'use strict'; -var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); +var $ = require('../internals/export'); var getBuiltIn = require('../internals/get-built-in'); +var bind = require('../internals/function-bind-context'); +var call = require('../internals/function-call'); var aCallable = require('../internals/a-callable'); var anObject = require('../internals/an-object'); -var bind = require('../internals/function-bind-context'); var speciesConstructor = require('../internals/species-constructor'); var getSetIterator = require('../internals/get-set-iterator'); var iterate = require('../internals/iterate'); @@ -19,7 +20,7 @@ $({ target: 'Set', proto: true, real: true, forced: IS_PURE }, { var newSet = new (speciesConstructor(set, getBuiltIn('Set')))(); var adder = aCallable(newSet.add); iterate(iterator, function (value) { - adder.call(newSet, boundFunction(value, value, set)); + call(adder, newSet, boundFunction(value, value, set)); }, { IS_ITERATOR: true }); return newSet; } diff --git a/packages/core-js/modules/esnext.set.symmetric-difference.js b/packages/core-js/modules/esnext.set.symmetric-difference.js index 649ec53dec3b..794be8a1ccaf 100644 --- a/packages/core-js/modules/esnext.set.symmetric-difference.js +++ b/packages/core-js/modules/esnext.set.symmetric-difference.js @@ -1,7 +1,8 @@ 'use strict'; -var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); +var $ = require('../internals/export'); var getBuiltIn = require('../internals/get-built-in'); +var call = require('../internals/function-call'); var aCallable = require('../internals/a-callable'); var anObject = require('../internals/an-object'); var speciesConstructor = require('../internals/species-constructor'); @@ -16,7 +17,7 @@ $({ target: 'Set', proto: true, real: true, forced: IS_PURE }, { var remover = aCallable(newSet['delete']); var adder = aCallable(newSet.add); iterate(iterable, function (value) { - remover.call(newSet, value) || adder.call(newSet, value); + call(remover, newSet, value) || call(adder, newSet, value); }); return newSet; }