Skip to content

Commit 088e0ad

Browse files
committed
change names of methods to *more probable* to- prefix schema
tc39/proposal-change-array-by-copy#10
1 parent 88f57f4 commit 088e0ad

File tree

71 files changed

+514
-519
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+514
-519
lines changed

packages/core-js-compat/src/data.mjs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1459,15 +1459,15 @@ export const data = {
14591459
// TODO: Remove from `core-js@4`
14601460
'esnext.array.last-item': {
14611461
},
1462-
'esnext.array.unique-by': {
1462+
'esnext.array.to-reversed': {
14631463
},
1464-
'esnext.array.with-at': {
1464+
'esnext.array.to-sorted': {
14651465
},
1466-
'esnext.array.with-reversed': {
1466+
'esnext.array.to-spliced': {
14671467
},
1468-
'esnext.array.with-sorted': {
1468+
'esnext.array.unique-by': {
14691469
},
1470-
'esnext.array.with-spliced': {
1470+
'esnext.array.with': {
14711471
},
14721472
'esnext.async-iterator.constructor': {
14731473
},
@@ -1737,15 +1737,15 @@ export const data = {
17371737
},
17381738
'esnext.typed-array.group-by': {
17391739
},
1740-
'esnext.typed-array.unique-by': {
1740+
'esnext.typed-array.to-reversed': {
17411741
},
1742-
'esnext.typed-array.with-at': {
1742+
'esnext.typed-array.to-sorted': {
17431743
},
1744-
'esnext.typed-array.with-reversed': {
1744+
'esnext.typed-array.to-spliced': {
17451745
},
1746-
'esnext.typed-array.with-sorted': {
1746+
'esnext.typed-array.unique-by': {
17471747
},
1748-
'esnext.typed-array.with-spliced': {
1748+
'esnext.typed-array.with': {
17491749
},
17501750
'esnext.weak-map.delete-all': {
17511751
},

packages/core-js-compat/src/modules-by-versions.mjs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,13 @@ export default {
112112
'esnext.typed-array.from-async',
113113
],
114114
'3.20': [
115-
'esnext.array.with-at',
116-
'esnext.array.with-reversed',
117-
'esnext.array.with-sorted',
118-
'esnext.array.with-spliced',
119-
'esnext.typed-array.with-at',
120-
'esnext.typed-array.with-reversed',
121-
'esnext.typed-array.with-sorted',
122-
'esnext.typed-array.with-spliced',
115+
'esnext.array.to-reversed',
116+
'esnext.array.to-sorted',
117+
'esnext.array.to-spliced',
118+
'esnext.array.with',
119+
'esnext.typed-array.to-reversed',
120+
'esnext.typed-array.to-sorted',
121+
'esnext.typed-array.to-spliced',
122+
'esnext.typed-array.with',
123123
],
124124
};

packages/core-js/features/array/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ require('../../modules/esnext.array.group-by');
1313
require('../../modules/esnext.array.is-template-object');
1414
require('../../modules/esnext.array.last-item');
1515
require('../../modules/esnext.array.last-index');
16+
require('../../modules/esnext.array.to-reversed');
17+
require('../../modules/esnext.array.to-sorted');
18+
require('../../modules/esnext.array.to-spliced');
1619
require('../../modules/esnext.array.unique-by');
17-
require('../../modules/esnext.array.with-at');
18-
require('../../modules/esnext.array.with-reversed');
19-
require('../../modules/esnext.array.with-sorted');
20-
require('../../modules/esnext.array.with-spliced');
20+
require('../../modules/esnext.array.with');
2121

2222
module.exports = parent;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
require('../../modules/esnext.array.to-reversed');
2+
var entryUnbind = require('../../internals/entry-unbind');
3+
4+
module.exports = entryUnbind('Array', 'toReversed');
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
require('../../modules/es.array.sort');
2+
require('../../modules/esnext.array.to-sorted');
3+
var entryUnbind = require('../../internals/entry-unbind');
4+
5+
module.exports = entryUnbind('Array', 'toSorted');
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
require('../../modules/esnext.array.to-spliced');
2+
var entryUnbind = require('../../internals/entry-unbind');
3+
4+
module.exports = entryUnbind('Array', 'toSpliced');

packages/core-js/features/array/virtual/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ require('../../../modules/esnext.array.filter-reject');
88
require('../../../modules/esnext.array.find-last');
99
require('../../../modules/esnext.array.find-last-index');
1010
require('../../../modules/esnext.array.group-by');
11+
require('../../../modules/esnext.array.to-reversed');
12+
require('../../../modules/esnext.array.to-sorted');
13+
require('../../../modules/esnext.array.to-spliced');
1114
require('../../../modules/esnext.array.unique-by');
12-
require('../../../modules/esnext.array.with-at');
13-
require('../../../modules/esnext.array.with-reversed');
14-
require('../../../modules/esnext.array.with-sorted');
15-
require('../../../modules/esnext.array.with-spliced');
15+
require('../../../modules/esnext.array.with');
1616

1717
module.exports = parent;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
require('../../../modules/esnext.array.to-reversed');
2+
var entryVirtual = require('../../../internals/entry-virtual');
3+
4+
module.exports = entryVirtual('Array').toReversed;
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
require('../../../modules/es.array.sort');
2-
require('../../../modules/esnext.array.with-sorted');
2+
require('../../../modules/esnext.array.to-sorted');
33
var entryVirtual = require('../../../internals/entry-virtual');
44

5-
module.exports = entryVirtual('Array').withSorted;
5+
module.exports = entryVirtual('Array').toSorted;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
require('../../../modules/esnext.array.to-spliced');
2+
var entryVirtual = require('../../../internals/entry-virtual');
3+
4+
module.exports = entryVirtual('Array').toSpliced;

packages/core-js/features/array/virtual/with-at.js

Lines changed: 0 additions & 4 deletions
This file was deleted.

packages/core-js/features/array/virtual/with-reversed.js

Lines changed: 0 additions & 4 deletions
This file was deleted.

packages/core-js/features/array/virtual/with-spliced.js

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
require('../../../modules/esnext.array.with');
2+
var entryVirtual = require('../../../internals/entry-virtual');
3+
4+
module.exports = entryVirtual('Array')['with'];

packages/core-js/features/array/with-at.js

Lines changed: 0 additions & 4 deletions
This file was deleted.

packages/core-js/features/array/with-reversed.js

Lines changed: 0 additions & 4 deletions
This file was deleted.

packages/core-js/features/array/with-sorted.js

Lines changed: 0 additions & 5 deletions
This file was deleted.

packages/core-js/features/array/with-spliced.js

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
require('../../modules/esnext.array.with');
2+
var entryUnbind = require('../../internals/entry-unbind');
3+
4+
module.exports = entryUnbind('Array', 'with');
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
var isPrototypeOf = require('../../internals/object-is-prototype-of');
2-
var method = require('../array/virtual/with-sorted');
2+
var method = require('../array/virtual/to-reversed');
33

44
var ArrayPrototype = Array.prototype;
55

66
module.exports = function (it) {
7-
var own = it.withSorted;
8-
return (it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.withSorted)) ? method : own;
7+
var own = it.toReversed;
8+
return (it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.toReversed)) ? method : own;
99
};
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
var isPrototypeOf = require('../../internals/object-is-prototype-of');
2-
var method = require('../array/virtual/with-spliced');
2+
var method = require('../array/virtual/to-sorted');
33

44
var ArrayPrototype = Array.prototype;
55

66
module.exports = function (it) {
7-
var own = it.withSpliced;
8-
return (it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.withSpliced)) ? method : own;
7+
var own = it.toSorted;
8+
return (it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.toSorted)) ? method : own;
99
};
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
var isPrototypeOf = require('../../internals/object-is-prototype-of');
2-
var method = require('../array/virtual/with-reversed');
2+
var method = require('../array/virtual/to-spliced');
33

44
var ArrayPrototype = Array.prototype;
55

66
module.exports = function (it) {
7-
var own = it.withReversed;
8-
return (it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.withReversed)) ? method : own;
7+
var own = it.toSpliced;
8+
return (it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.toSpliced)) ? method : own;
99
};
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
var isPrototypeOf = require('../../internals/object-is-prototype-of');
2-
var method = require('../array/virtual/with-at');
2+
var method = require('../array/virtual/with');
33

44
var ArrayPrototype = Array.prototype;
55

66
module.exports = function (it) {
7-
var own = it.withAt;
8-
return (it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.withAt)) ? method : own;
7+
var own = it['with'];
8+
return (it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype['with'])) ? method : own;
99
};

packages/core-js/features/typed-array/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ require('../../modules/esnext.typed-array.filter-reject');
1010
require('../../modules/esnext.typed-array.find-last');
1111
require('../../modules/esnext.typed-array.find-last-index');
1212
require('../../modules/esnext.typed-array.group-by');
13+
require('../../modules/esnext.typed-array.to-reversed');
14+
require('../../modules/esnext.typed-array.to-sorted');
15+
require('../../modules/esnext.typed-array.to-spliced');
1316
require('../../modules/esnext.typed-array.unique-by');
14-
require('../../modules/esnext.typed-array.with-at');
15-
require('../../modules/esnext.typed-array.with-reversed');
16-
require('../../modules/esnext.typed-array.with-sorted');
17-
require('../../modules/esnext.typed-array.with-spliced');
17+
require('../../modules/esnext.typed-array.with');
1818

1919
module.exports = parent;

packages/core-js/features/typed-array/methods.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ require('../../modules/esnext.typed-array.filter-reject');
1010
require('../../modules/esnext.typed-array.find-last');
1111
require('../../modules/esnext.typed-array.find-last-index');
1212
require('../../modules/esnext.typed-array.group-by');
13+
require('../../modules/esnext.typed-array.to-reversed');
14+
require('../../modules/esnext.typed-array.to-sorted');
15+
require('../../modules/esnext.typed-array.to-spliced');
1316
require('../../modules/esnext.typed-array.unique-by');
14-
require('../../modules/esnext.typed-array.with-at');
15-
require('../../modules/esnext.typed-array.with-reversed');
16-
require('../../modules/esnext.typed-array.with-sorted');
17-
require('../../modules/esnext.typed-array.with-spliced');
17+
require('../../modules/esnext.typed-array.with');
1818

1919
module.exports = parent;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
require('../../modules/esnext.typed-array.to-reversed');
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
require('../../modules/es.typed-array.sort');
2+
require('../../modules/esnext.typed-array.to-sorted');
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
require('../../modules/esnext.typed-array.to-spliced');

packages/core-js/features/typed-array/with-at.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/core-js/features/typed-array/with-reversed.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/core-js/features/typed-array/with-sorted.js

Lines changed: 0 additions & 2 deletions
This file was deleted.

packages/core-js/features/typed-array/with-spliced.js

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
require('../../modules/esnext.typed-array.with');

packages/core-js/internals/array-with-reversed.js renamed to packages/core-js/internals/array-to-reversed.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
var lengthOfArrayLike = require('../internals/length-of-array-like');
22

3-
// https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.withReversed
4-
// https://tc39.es/proposal-change-array-by-copy/#sec-%typedarray%.prototype.withReversed
3+
// https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.toReversed
4+
// https://tc39.es/proposal-change-array-by-copy/#sec-%typedarray%.prototype.toReversed
55
module.exports = function (O, C) {
66
var len = lengthOfArrayLike(O);
77
var A = new C(len);

packages/core-js/internals/array-with-spliced.js renamed to packages/core-js/internals/array-to-spliced.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ var toIntegerOrInfinity = require('../internals/to-integer-or-infinity');
55
var max = Math.max;
66
var min = Math.min;
77

8-
// https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.withSpliced
9-
// https://tc39.es/proposal-change-array-by-copy/#sec-%typedarray%.prototype.withSpliced
8+
// https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.toSpliced
9+
// https://tc39.es/proposal-change-array-by-copy/#sec-%typedarray%.prototype.toSpliced
1010
module.exports = function (O, C, args) {
1111
var start = args[0];
1212
var deleteCount = args[1];

packages/core-js/internals/array-with-at.js renamed to packages/core-js/internals/array-with.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ var isIntegralNumber = require('../internals/is-integral-number');
55
var RangeError = global.RangeError;
66
var ERROR_MESSAGE = 'Incorrect index';
77

8-
// https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.withAt
9-
// https://tc39.es/proposal-change-array-by-copy/#sec-%typedarray%.prototype.withAt
8+
// https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.with
9+
// https://tc39.es/proposal-change-array-by-copy/#sec-%typedarray%.prototype.with
1010
module.exports = function (O, C, index, value) {
1111
var len = lengthOfArrayLike(O);
1212
if (!isIntegralNumber(index) || index >= len) throw RangeError(ERROR_MESSAGE);
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
'use strict';
22
var $ = require('../internals/export');
33
var global = require('../internals/global');
4-
var arrayWithAt = require('../internals/array-with-at');
4+
var arrayToReversed = require('../internals/array-to-reversed');
55
var toIndexedObject = require('../internals/to-indexed-object');
66
var addToUnscopables = require('../internals/add-to-unscopables');
77

88
var Array = global.Array;
99

10-
// `Array.prototype.withAt` method
11-
// https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.withAt
10+
// `Array.prototype.toReversed` method
11+
// https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.toReversed
1212
$({ target: 'Array', proto: true }, {
13-
withAt: function withAt(index, value) {
14-
return arrayWithAt(toIndexedObject(this), Array, index, value);
13+
toReversed: function toReversed() {
14+
return arrayToReversed(toIndexedObject(this), Array);
1515
}
1616
});
1717

18-
addToUnscopables('withAt');
18+
addToUnscopables('toReversed');

packages/core-js/modules/esnext.array.with-sorted.js renamed to packages/core-js/modules/esnext.array.to-sorted.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ var addToUnscopables = require('../internals/add-to-unscopables');
1111
var Array = global.Array;
1212
var sort = uncurryThis(getVirtual('Array').sort);
1313

14-
// `Array.prototype.withSorted` method
15-
// https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.withSorted
14+
// `Array.prototype.toSorted` method
15+
// https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.toSorted
1616
$({ target: 'Array', proto: true }, {
17-
withSorted: function withSorted(compareFn) {
17+
toSorted: function toSorted(compareFn) {
1818
if (compareFn !== undefined) aCallable(compareFn);
1919
var O = toIndexedObject(this);
2020
var A = arrayFromConstructorAndList(Array, O);
2121
return sort(A, compareFn);
2222
}
2323
});
2424

25-
addToUnscopables('withSorted');
25+
addToUnscopables('toSorted');

packages/core-js/modules/esnext.array.with-spliced.js renamed to packages/core-js/modules/esnext.array.to-spliced.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@ var $ = require('../internals/export');
33
var global = require('../internals/global');
44
var toIndexedObject = require('../internals/to-indexed-object');
55
var arraySlice = require('../internals/array-slice');
6-
var arrayWithSpliced = require('../internals/array-with-spliced');
6+
var arrayToSpliced = require('../internals/array-to-spliced');
77
var addToUnscopables = require('../internals/add-to-unscopables');
88

99
var Array = global.Array;
1010

11-
// `Array.prototype.withSpliced` method
12-
// https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.withSpliced
11+
// `Array.prototype.toSpliced` method
12+
// https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.toSpliced
1313
$({ target: 'Array', proto: true }, {
1414
// eslint-disable-next-line no-unused-vars -- required for .length
15-
withSpliced: function withSpliced(start, deleteCount /* , ...items */) {
16-
return arrayWithSpliced(toIndexedObject(this), Array, arraySlice(arguments));
15+
toSpliced: function toSpliced(start, deleteCount /* , ...items */) {
16+
return arrayToSpliced(toIndexedObject(this), Array, arraySlice(arguments));
1717
}
1818
});
1919

20-
addToUnscopables('withSpliced');
20+
addToUnscopables('toSpliced');

packages/core-js/modules/esnext.array.with-reversed.js

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)