Skip to content

Commit

Permalink
change names of methods to *more probable* to- prefix schema
Browse files Browse the repository at this point in the history
  • Loading branch information
zloirock committed Nov 9, 2021
1 parent a808f17 commit 3c0cee8
Show file tree
Hide file tree
Showing 71 changed files with 514 additions and 519 deletions.
20 changes: 10 additions & 10 deletions packages/core-js-compat/src/data.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1459,15 +1459,15 @@ export const data = {
// TODO: Remove from `core-js@4`
'esnext.array.last-item': {
},
'esnext.array.unique-by': {
'esnext.array.to-reversed': {
},
'esnext.array.with-at': {
'esnext.array.to-sorted': {
},
'esnext.array.with-reversed': {
'esnext.array.to-spliced': {
},
'esnext.array.with-sorted': {
'esnext.array.unique-by': {
},
'esnext.array.with-spliced': {
'esnext.array.with': {
},
'esnext.async-iterator.constructor': {
},
Expand Down Expand Up @@ -1737,15 +1737,15 @@ export const data = {
},
'esnext.typed-array.group-by': {
},
'esnext.typed-array.unique-by': {
'esnext.typed-array.to-reversed': {
},
'esnext.typed-array.with-at': {
'esnext.typed-array.to-sorted': {
},
'esnext.typed-array.with-reversed': {
'esnext.typed-array.to-spliced': {
},
'esnext.typed-array.with-sorted': {
'esnext.typed-array.unique-by': {
},
'esnext.typed-array.with-spliced': {
'esnext.typed-array.with': {
},
'esnext.weak-map.delete-all': {
},
Expand Down
16 changes: 8 additions & 8 deletions packages/core-js-compat/src/modules-by-versions.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,13 @@ export default {
'esnext.typed-array.from-async',
],
'3.20': [
'esnext.array.with-at',
'esnext.array.with-reversed',
'esnext.array.with-sorted',
'esnext.array.with-spliced',
'esnext.typed-array.with-at',
'esnext.typed-array.with-reversed',
'esnext.typed-array.with-sorted',
'esnext.typed-array.with-spliced',
'esnext.array.to-reversed',
'esnext.array.to-sorted',
'esnext.array.to-spliced',
'esnext.array.with',
'esnext.typed-array.to-reversed',
'esnext.typed-array.to-sorted',
'esnext.typed-array.to-spliced',
'esnext.typed-array.with',
],
};
8 changes: 4 additions & 4 deletions packages/core-js/features/array/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ require('../../modules/esnext.array.group-by');
require('../../modules/esnext.array.is-template-object');
require('../../modules/esnext.array.last-item');
require('../../modules/esnext.array.last-index');
require('../../modules/esnext.array.to-reversed');
require('../../modules/esnext.array.to-sorted');
require('../../modules/esnext.array.to-spliced');
require('../../modules/esnext.array.unique-by');
require('../../modules/esnext.array.with-at');
require('../../modules/esnext.array.with-reversed');
require('../../modules/esnext.array.with-sorted');
require('../../modules/esnext.array.with-spliced');
require('../../modules/esnext.array.with');

module.exports = parent;
4 changes: 4 additions & 0 deletions packages/core-js/features/array/to-reversed.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
require('../../modules/esnext.array.to-reversed');
var entryUnbind = require('../../internals/entry-unbind');

module.exports = entryUnbind('Array', 'toReversed');
5 changes: 5 additions & 0 deletions packages/core-js/features/array/to-sorted.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
require('../../modules/es.array.sort');
require('../../modules/esnext.array.to-sorted');
var entryUnbind = require('../../internals/entry-unbind');

module.exports = entryUnbind('Array', 'toSorted');
4 changes: 4 additions & 0 deletions packages/core-js/features/array/to-spliced.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
require('../../modules/esnext.array.to-spliced');
var entryUnbind = require('../../internals/entry-unbind');

module.exports = entryUnbind('Array', 'toSpliced');
8 changes: 4 additions & 4 deletions packages/core-js/features/array/virtual/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ require('../../../modules/esnext.array.filter-reject');
require('../../../modules/esnext.array.find-last');
require('../../../modules/esnext.array.find-last-index');
require('../../../modules/esnext.array.group-by');
require('../../../modules/esnext.array.to-reversed');
require('../../../modules/esnext.array.to-sorted');
require('../../../modules/esnext.array.to-spliced');
require('../../../modules/esnext.array.unique-by');
require('../../../modules/esnext.array.with-at');
require('../../../modules/esnext.array.with-reversed');
require('../../../modules/esnext.array.with-sorted');
require('../../../modules/esnext.array.with-spliced');
require('../../../modules/esnext.array.with');

module.exports = parent;
4 changes: 4 additions & 0 deletions packages/core-js/features/array/virtual/to-reversed.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
require('../../../modules/esnext.array.to-reversed');
var entryVirtual = require('../../../internals/entry-virtual');

module.exports = entryVirtual('Array').toReversed;
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require('../../../modules/es.array.sort');
require('../../../modules/esnext.array.with-sorted');
require('../../../modules/esnext.array.to-sorted');
var entryVirtual = require('../../../internals/entry-virtual');

module.exports = entryVirtual('Array').withSorted;
module.exports = entryVirtual('Array').toSorted;
4 changes: 4 additions & 0 deletions packages/core-js/features/array/virtual/to-spliced.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
require('../../../modules/esnext.array.to-spliced');
var entryVirtual = require('../../../internals/entry-virtual');

module.exports = entryVirtual('Array').toSpliced;
4 changes: 0 additions & 4 deletions packages/core-js/features/array/virtual/with-at.js

This file was deleted.

4 changes: 0 additions & 4 deletions packages/core-js/features/array/virtual/with-reversed.js

This file was deleted.

4 changes: 0 additions & 4 deletions packages/core-js/features/array/virtual/with-spliced.js

This file was deleted.

4 changes: 4 additions & 0 deletions packages/core-js/features/array/virtual/with.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
require('../../../modules/esnext.array.with');
var entryVirtual = require('../../../internals/entry-virtual');

module.exports = entryVirtual('Array')['with'];
4 changes: 0 additions & 4 deletions packages/core-js/features/array/with-at.js

This file was deleted.

4 changes: 0 additions & 4 deletions packages/core-js/features/array/with-reversed.js

This file was deleted.

5 changes: 0 additions & 5 deletions packages/core-js/features/array/with-sorted.js

This file was deleted.

4 changes: 0 additions & 4 deletions packages/core-js/features/array/with-spliced.js

This file was deleted.

4 changes: 4 additions & 0 deletions packages/core-js/features/array/with.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
require('../../modules/esnext.array.with');
var entryUnbind = require('../../internals/entry-unbind');

module.exports = entryUnbind('Array', 'with');
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
var isPrototypeOf = require('../../internals/object-is-prototype-of');
var method = require('../array/virtual/with-sorted');
var method = require('../array/virtual/to-reversed');

var ArrayPrototype = Array.prototype;

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

var ArrayPrototype = Array.prototype;

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

var ArrayPrototype = Array.prototype;

module.exports = function (it) {
var own = it.withReversed;
return (it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.withReversed)) ? method : own;
var own = it.toSpliced;
return (it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.toSpliced)) ? method : own;
};
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
var isPrototypeOf = require('../../internals/object-is-prototype-of');
var method = require('../array/virtual/with-at');
var method = require('../array/virtual/with');

var ArrayPrototype = Array.prototype;

module.exports = function (it) {
var own = it.withAt;
return (it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.withAt)) ? method : own;
var own = it['with'];
return (it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype['with'])) ? method : own;
};
8 changes: 4 additions & 4 deletions packages/core-js/features/typed-array/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ require('../../modules/esnext.typed-array.filter-reject');
require('../../modules/esnext.typed-array.find-last');
require('../../modules/esnext.typed-array.find-last-index');
require('../../modules/esnext.typed-array.group-by');
require('../../modules/esnext.typed-array.to-reversed');
require('../../modules/esnext.typed-array.to-sorted');
require('../../modules/esnext.typed-array.to-spliced');
require('../../modules/esnext.typed-array.unique-by');
require('../../modules/esnext.typed-array.with-at');
require('../../modules/esnext.typed-array.with-reversed');
require('../../modules/esnext.typed-array.with-sorted');
require('../../modules/esnext.typed-array.with-spliced');
require('../../modules/esnext.typed-array.with');

module.exports = parent;
8 changes: 4 additions & 4 deletions packages/core-js/features/typed-array/methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ require('../../modules/esnext.typed-array.filter-reject');
require('../../modules/esnext.typed-array.find-last');
require('../../modules/esnext.typed-array.find-last-index');
require('../../modules/esnext.typed-array.group-by');
require('../../modules/esnext.typed-array.to-reversed');
require('../../modules/esnext.typed-array.to-sorted');
require('../../modules/esnext.typed-array.to-spliced');
require('../../modules/esnext.typed-array.unique-by');
require('../../modules/esnext.typed-array.with-at');
require('../../modules/esnext.typed-array.with-reversed');
require('../../modules/esnext.typed-array.with-sorted');
require('../../modules/esnext.typed-array.with-spliced');
require('../../modules/esnext.typed-array.with');

module.exports = parent;
1 change: 1 addition & 0 deletions packages/core-js/features/typed-array/to-reversed.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require('../../modules/esnext.typed-array.to-reversed');
2 changes: 2 additions & 0 deletions packages/core-js/features/typed-array/to-sorted.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
require('../../modules/es.typed-array.sort');
require('../../modules/esnext.typed-array.to-sorted');
1 change: 1 addition & 0 deletions packages/core-js/features/typed-array/to-spliced.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require('../../modules/esnext.typed-array.to-spliced');
1 change: 0 additions & 1 deletion packages/core-js/features/typed-array/with-at.js

This file was deleted.

1 change: 0 additions & 1 deletion packages/core-js/features/typed-array/with-reversed.js

This file was deleted.

2 changes: 0 additions & 2 deletions packages/core-js/features/typed-array/with-sorted.js

This file was deleted.

1 change: 0 additions & 1 deletion packages/core-js/features/typed-array/with-spliced.js

This file was deleted.

1 change: 1 addition & 0 deletions packages/core-js/features/typed-array/with.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require('../../modules/esnext.typed-array.with');
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var lengthOfArrayLike = require('../internals/length-of-array-like');

// https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.withReversed
// https://tc39.es/proposal-change-array-by-copy/#sec-%typedarray%.prototype.withReversed
// https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.toReversed
// https://tc39.es/proposal-change-array-by-copy/#sec-%typedarray%.prototype.toReversed
module.exports = function (O, C) {
var len = lengthOfArrayLike(O);
var A = new C(len);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ var toIntegerOrInfinity = require('../internals/to-integer-or-infinity');
var max = Math.max;
var min = Math.min;

// https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.withSpliced
// https://tc39.es/proposal-change-array-by-copy/#sec-%typedarray%.prototype.withSpliced
// https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.toSpliced
// https://tc39.es/proposal-change-array-by-copy/#sec-%typedarray%.prototype.toSpliced
module.exports = function (O, C, args) {
var start = args[0];
var deleteCount = args[1];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ var isIntegralNumber = require('../internals/is-integral-number');
var RangeError = global.RangeError;
var ERROR_MESSAGE = 'Incorrect index';

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

var Array = global.Array;

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

addToUnscopables('withAt');
addToUnscopables('toReversed');
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ var addToUnscopables = require('../internals/add-to-unscopables');
var Array = global.Array;
var sort = uncurryThis(getVirtual('Array').sort);

// `Array.prototype.withSorted` method
// https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.withSorted
// `Array.prototype.toSorted` method
// https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.toSorted
$({ target: 'Array', proto: true }, {
withSorted: function withSorted(compareFn) {
toSorted: function toSorted(compareFn) {
if (compareFn !== undefined) aCallable(compareFn);
var O = toIndexedObject(this);
var A = arrayFromConstructorAndList(Array, O);
return sort(A, compareFn);
}
});

addToUnscopables('withSorted');
addToUnscopables('toSorted');
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ var $ = require('../internals/export');
var global = require('../internals/global');
var toIndexedObject = require('../internals/to-indexed-object');
var arraySlice = require('../internals/array-slice');
var arrayWithSpliced = require('../internals/array-with-spliced');
var arrayToSpliced = require('../internals/array-to-spliced');
var addToUnscopables = require('../internals/add-to-unscopables');

var Array = global.Array;

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

addToUnscopables('withSpliced');
addToUnscopables('toSpliced');
18 changes: 0 additions & 18 deletions packages/core-js/modules/esnext.array.with-reversed.js

This file was deleted.

Loading

0 comments on commit 3c0cee8

Please sign in to comment.