Skip to content

Commit

Permalink
forced replacement of all methods from early stage proposals for avoi…
Browse files Browse the repository at this point in the history
…ding possible web compatibility issues in the future
  • Loading branch information
zloirock committed Feb 1, 2022
1 parent 985d127 commit 248a3ea
Show file tree
Hide file tree
Showing 123 changed files with 131 additions and 165 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- `atob`
- `btoa`
- Added the proper validation of arguments to some methods from web standards
- Forced replacement of all methods from early stage proposals for avoiding possible web compatibility issues in the future
- Added Rhino 1.7.14 compat data
- Added Deno 1.19 compat data mapping
- Added Opera Android 66 and 67 compat data mapping
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/modules/esnext.array.filter-out.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var addToUnscopables = require('../internals/add-to-unscopables');

// `Array.prototype.filterOut` method
// https://github.com/tc39/proposal-array-filtering
$({ target: 'Array', proto: true }, {
$({ target: 'Array', proto: true, forced: true }, {
filterOut: function filterOut(callbackfn /* , thisArg */) {
return $filterReject(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/modules/esnext.array.filter-reject.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var addToUnscopables = require('../internals/add-to-unscopables');

// `Array.prototype.filterReject` method
// https://github.com/tc39/proposal-array-filtering
$({ target: 'Array', proto: true }, {
$({ target: 'Array', proto: true, forced: true }, {
filterReject: function filterReject(callbackfn /* , thisArg */) {
return $filterReject(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/modules/esnext.array.from-async.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ var fromAsync = require('../internals/array-from-async');

// `Array.fromAsync` method
// https://github.com/tc39/proposal-array-from-async
$({ target: 'Array', stat: true }, {
$({ target: 'Array', stat: true, forced: true }, {
fromAsync: fromAsync
});
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var isFrozenStringArray = function (array, allowUndefined) {

// `Array.isTemplateObject` method
// https://github.com/tc39/proposal-array-is-template-object
$({ target: 'Array', stat: true }, {
$({ target: 'Array', stat: true, sham: true, forced: true }, {
isTemplateObject: function isTemplateObject(value) {
if (!isFrozenStringArray(value, true)) return false;
var raw = value.raw;
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/modules/esnext.array.last-index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var defineProperty = require('../internals/object-define-property').f;

// `Array.prototype.lastIndex` getter
// https://github.com/keithamus/proposal-array-last
if (DESCRIPTORS && !('lastIndex' in [])) {
if (DESCRIPTORS) {
defineProperty(Array.prototype, 'lastIndex', {
configurable: true,
get: function lastIndex() {
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/modules/esnext.array.last-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var defineProperty = require('../internals/object-define-property').f;

// `Array.prototype.lastIndex` accessor
// https://github.com/keithamus/proposal-array-last
if (DESCRIPTORS && !('lastItem' in [])) {
if (DESCRIPTORS) {
defineProperty(Array.prototype, 'lastItem', {
configurable: true,
get: function lastItem() {
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/modules/esnext.array.to-reversed.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var Array = global.Array;

// `Array.prototype.toReversed` method
// https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.toReversed
$({ target: 'Array', proto: true }, {
$({ target: 'Array', proto: true, forced: true }, {
toReversed: function toReversed() {
return arrayToReversed(toIndexedObject(this), Array);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/modules/esnext.array.to-sorted.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var sort = uncurryThis(getVirtual('Array').sort);

// `Array.prototype.toSorted` method
// https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.toSorted
$({ target: 'Array', proto: true }, {
$({ target: 'Array', proto: true, forced: true }, {
toSorted: function toSorted(compareFn) {
if (compareFn !== undefined) aCallable(compareFn);
var O = toIndexedObject(this);
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/modules/esnext.array.to-spliced.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var Array = global.Array;

// `Array.prototype.toSpliced` method
// https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.toSpliced
$({ target: 'Array', proto: true }, {
$({ target: 'Array', proto: true, forced: true }, {
// eslint-disable-next-line no-unused-vars -- required for .length
toSpliced: function toSpliced(start, deleteCount /* , ...items */) {
return arrayToSpliced(toIndexedObject(this), Array, arraySlice(arguments));
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/modules/esnext.array.unique-by.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var uniqueBy = require('../internals/array-unique-by');

// `Array.prototype.uniqueBy` method
// https://github.com/tc39/proposal-array-unique
$({ target: 'Array', proto: true }, {
$({ target: 'Array', proto: true, forced: true }, {
uniqueBy: uniqueBy
});

Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/modules/esnext.array.with.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ var Array = global.Array;

// `Array.prototype.with` method
// https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.with
$({ target: 'Array', proto: true }, {
$({ target: 'Array', proto: true, forced: true }, {
'with': function (index, value) {
return arrayWith(toIndexedObject(this), Array, index, value);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var AsyncIteratorProxy = createAsyncIteratorProxy(function (Promise, args) {
});
});

$({ target: 'AsyncIterator', proto: true, real: true }, {
$({ target: 'AsyncIterator', proto: true, real: true, forced: true }, {
asIndexedPairs: function asIndexedPairs() {
return new AsyncIteratorProxy({
iterator: anObject(this),
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/modules/esnext.async-iterator.drop.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ var AsyncIteratorProxy = createAsyncIteratorProxy(function (Promise, args) {
});
});

$({ target: 'AsyncIterator', proto: true, real: true }, {
$({ target: 'AsyncIterator', proto: true, real: true, forced: true }, {
drop: function drop(limit) {
return new AsyncIteratorProxy({
iterator: anObject(this),
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/modules/esnext.async-iterator.every.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
var $ = require('../internals/export');
var $every = require('../internals/async-iterator-iteration').every;

$({ target: 'AsyncIterator', proto: true, real: true }, {
$({ target: 'AsyncIterator', proto: true, real: true, forced: true }, {
every: function every(fn) {
return $every(this, fn);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/modules/esnext.async-iterator.filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ var AsyncIteratorProxy = createAsyncIteratorProxy(function (Promise, args) {
});
});

$({ target: 'AsyncIterator', proto: true, real: true }, {
$({ target: 'AsyncIterator', proto: true, real: true, forced: true }, {
filter: function filter(filterer) {
return new AsyncIteratorProxy({
iterator: anObject(this),
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/modules/esnext.async-iterator.find.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
var $ = require('../internals/export');
var $find = require('../internals/async-iterator-iteration').find;

$({ target: 'AsyncIterator', proto: true, real: true }, {
$({ target: 'AsyncIterator', proto: true, real: true, forced: true }, {
find: function find(fn) {
return $find(this, fn);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/modules/esnext.async-iterator.flat-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ var AsyncIteratorProxy = createAsyncIteratorProxy(function (Promise) {
});
});

$({ target: 'AsyncIterator', proto: true, real: true }, {
$({ target: 'AsyncIterator', proto: true, real: true, forced: true }, {
flatMap: function flatMap(mapper) {
return new AsyncIteratorProxy({
iterator: anObject(this),
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/modules/esnext.async-iterator.for-each.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
var $ = require('../internals/export');
var $forEach = require('../internals/async-iterator-iteration').forEach;

$({ target: 'AsyncIterator', proto: true, real: true }, {
$({ target: 'AsyncIterator', proto: true, real: true, forced: true }, {
forEach: function forEach(fn) {
return $forEach(this, fn);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/modules/esnext.async-iterator.from.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var AsyncIteratorProxy = createAsyncIteratorProxy(function (Promise, args) {
return anObject(apply(this.next, this.iterator, args));
}, true);

$({ target: 'AsyncIterator', stat: true }, {
$({ target: 'AsyncIterator', stat: true, forced: true }, {
from: function from(O) {
var object = toObject(O);
var usingIterator = getMethod(object, ASYNC_ITERATOR);
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/modules/esnext.async-iterator.map.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var AsyncIteratorProxy = createAsyncIteratorProxy(function (Promise, args) {
});
});

$({ target: 'AsyncIterator', proto: true, real: true }, {
$({ target: 'AsyncIterator', proto: true, real: true, forced: true }, {
map: function map(mapper) {
return new AsyncIteratorProxy({
iterator: anObject(this),
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/modules/esnext.async-iterator.reduce.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var getBuiltIn = require('../internals/get-built-in');
var Promise = getBuiltIn('Promise');
var TypeError = global.TypeError;

$({ target: 'AsyncIterator', proto: true, real: true }, {
$({ target: 'AsyncIterator', proto: true, real: true, forced: true }, {
reduce: function reduce(reducer /* , initialValue */) {
var iterator = anObject(this);
var next = aCallable(iterator.next);
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/modules/esnext.async-iterator.some.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
var $ = require('../internals/export');
var $some = require('../internals/async-iterator-iteration').some;

$({ target: 'AsyncIterator', proto: true, real: true }, {
$({ target: 'AsyncIterator', proto: true, real: true, forced: true }, {
some: function some(fn) {
return $some(this, fn);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/modules/esnext.async-iterator.take.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var AsyncIteratorProxy = createAsyncIteratorProxy(function (Promise, args) {
} return apply(this.next, iterator, args);
});

$({ target: 'AsyncIterator', proto: true, real: true }, {
$({ target: 'AsyncIterator', proto: true, real: true, forced: true }, {
take: function take(limit) {
return new AsyncIteratorProxy({
iterator: anObject(this),
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/modules/esnext.async-iterator.to-array.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
var $ = require('../internals/export');
var $toArray = require('../internals/async-iterator-iteration').toArray;

$({ target: 'AsyncIterator', proto: true, real: true }, {
$({ target: 'AsyncIterator', proto: true, real: true, forced: true }, {
toArray: function toArray() {
return $toArray(this, undefined, []);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/modules/esnext.bigint.range.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var NumericRangeIterator = require('../internals/numeric-range-iterator');
// `BigInt.range` method
// https://github.com/tc39/proposal-Number.range
if (typeof BigInt == 'function') {
$({ target: 'BigInt', stat: true }, {
$({ target: 'BigInt', stat: true, forced: true }, {
range: function range(start, end, option) {
return new NumericRangeIterator(start, end, option, 'bigint', BigInt(0), BigInt(1));
}
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/modules/esnext.composite-key.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var initializer = function () {
};

// https://github.com/tc39/proposal-richer-keys/tree/master/compositeKey
$({ global: true }, {
$({ global: true, forced: true }, {
compositeKey: function compositeKey() {
return apply(getCompositeKeyNode, Object, arguments).get('object', initializer);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/modules/esnext.composite-symbol.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var getBuiltIn = require('../internals/get-built-in');
var apply = require('../internals/function-apply');

// https://github.com/tc39/proposal-richer-keys/tree/master/compositeKey
$({ global: true }, {
$({ global: true, forced: true }, {
compositeSymbol: function compositeSymbol() {
if (arguments.length == 1 && typeof arguments[0] == 'string') return getBuiltIn('Symbol')['for'](arguments[0]);
return apply(getCompositeKeyNode, null, arguments).get('symbol', getBuiltIn('Symbol'));
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/modules/esnext.function.is-callable.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var isClassConstructor = function (argument) {

// `Function.isCallable` method
// https://github.com/caitp/TC39-Proposals/blob/trunk/tc39-reflect-isconstructor-iscallable.md
$({ target: 'Function', stat: true, sham: true }, {
$({ target: 'Function', stat: true, sham: true, forced: true }, {
isCallable: function isCallable(argument) {
return $isCallable(argument) && !isClassConstructor(argument);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/modules/esnext.function.is-constructor.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ var isConstructor = require('../internals/is-constructor');

// `Function.isConstructor` method
// https://github.com/caitp/TC39-Proposals/blob/trunk/tc39-reflect-isconstructor-iscallable.md
$({ target: 'Function', stat: true }, {
$({ target: 'Function', stat: true, forced: true }, {
isConstructor: isConstructor
});
2 changes: 1 addition & 1 deletion packages/core-js/modules/esnext.function.un-this.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var aCallable = require('../internals/a-callable');

// `Function.prototype.unThis` method
// https://github.com/js-choi/proposal-function-un-this
$({ target: 'Function', proto: true }, {
$({ target: 'Function', proto: true, forced: true }, {
unThis: function unThis() {
return uncurryThis(aCallable(this));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var IteratorProxy = createIteratorProxy(function (args) {
if (!done) return [this.index++, result.value];
});

$({ target: 'Iterator', proto: true, real: true }, {
$({ target: 'Iterator', proto: true, real: true, forced: true }, {
asIndexedPairs: function asIndexedPairs() {
return new IteratorProxy({
iterator: anObject(this),
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/modules/esnext.iterator.drop.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var IteratorProxy = createIteratorProxy(function (args) {
if (!done) return result.value;
});

$({ target: 'Iterator', proto: true, real: true }, {
$({ target: 'Iterator', proto: true, real: true, forced: true }, {
drop: function drop(limit) {
return new IteratorProxy({
iterator: anObject(this),
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/modules/esnext.iterator.every.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var iterate = require('../internals/iterate');
var aCallable = require('../internals/a-callable');
var anObject = require('../internals/an-object');

$({ target: 'Iterator', proto: true, real: true }, {
$({ target: 'Iterator', proto: true, real: true, forced: true }, {
every: function every(fn) {
anObject(this);
aCallable(fn);
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/modules/esnext.iterator.filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var IteratorProxy = createIteratorProxy(function (args) {
}
});

$({ target: 'Iterator', proto: true, real: true }, {
$({ target: 'Iterator', proto: true, real: true, forced: true }, {
filter: function filter(filterer) {
return new IteratorProxy({
iterator: anObject(this),
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/modules/esnext.iterator.find.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var iterate = require('../internals/iterate');
var aCallable = require('../internals/a-callable');
var anObject = require('../internals/an-object');

$({ target: 'Iterator', proto: true, real: true }, {
$({ target: 'Iterator', proto: true, real: true, forced: true }, {
find: function find(fn) {
anObject(this);
aCallable(fn);
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/modules/esnext.iterator.flat-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ var IteratorProxy = createIteratorProxy(function () {
}
});

$({ target: 'Iterator', proto: true, real: true }, {
$({ target: 'Iterator', proto: true, real: true, forced: true }, {
flatMap: function flatMap(mapper) {
return new IteratorProxy({
iterator: anObject(this),
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/modules/esnext.iterator.for-each.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var $ = require('../internals/export');
var iterate = require('../internals/iterate');
var anObject = require('../internals/an-object');

$({ target: 'Iterator', proto: true, real: true }, {
$({ target: 'Iterator', proto: true, real: true, forced: true }, {
forEach: function forEach(fn) {
iterate(anObject(this), fn, { IS_ITERATOR: true });
}
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/modules/esnext.iterator.from.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var IteratorProxy = createIteratorProxy(function (args) {
if (!done) return result.value;
}, true);

$({ target: 'Iterator', stat: true }, {
$({ target: 'Iterator', stat: true, forced: true }, {
from: function from(O) {
var object = toObject(O);
var usingIterator = getIteratorMethod(object);
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/modules/esnext.iterator.map.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var IteratorProxy = createIteratorProxy(function (args) {
if (!done) return callWithSafeIterationClosing(iterator, this.mapper, result.value);
});

$({ target: 'Iterator', proto: true, real: true }, {
$({ target: 'Iterator', proto: true, real: true, forced: true }, {
map: function map(mapper) {
return new IteratorProxy({
iterator: anObject(this),
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/modules/esnext.iterator.reduce.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ var anObject = require('../internals/an-object');

var TypeError = global.TypeError;

$({ target: 'Iterator', proto: true, real: true }, {
$({ target: 'Iterator', proto: true, real: true, forced: true }, {
reduce: function reduce(reducer /* , initialValue */) {
anObject(this);
aCallable(reducer);
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/modules/esnext.iterator.some.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var iterate = require('../internals/iterate');
var aCallable = require('../internals/a-callable');
var anObject = require('../internals/an-object');

$({ target: 'Iterator', proto: true, real: true }, {
$({ target: 'Iterator', proto: true, real: true, forced: true }, {
some: function some(fn) {
anObject(this);
aCallable(fn);
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/modules/esnext.iterator.take.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var IteratorProxy = createIteratorProxy(function (args) {
if (!done) return result.value;
});

$({ target: 'Iterator', proto: true, real: true }, {
$({ target: 'Iterator', proto: true, real: true, forced: true }, {
take: function take(limit) {
return new IteratorProxy({
iterator: anObject(this),
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/modules/esnext.iterator.to-array.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var anObject = require('../internals/an-object');

var push = [].push;

$({ target: 'Iterator', proto: true, real: true }, {
$({ target: 'Iterator', proto: true, real: true, forced: true }, {
toArray: function toArray() {
var result = [];
iterate(anObject(this), push, { that: result, IS_ITERATOR: true });
Expand Down
Loading

0 comments on commit 248a3ea

Please sign in to comment.