Skip to content

Commit

Permalink
add new entries
Browse files Browse the repository at this point in the history
  • Loading branch information
zloirock committed Jun 9, 2022
1 parent 56aac57 commit f719025
Show file tree
Hide file tree
Showing 17 changed files with 76 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/core-js/actual/array/unshift.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
var parent = require('../../stable/array/unshift');

module.exports = parent;
3 changes: 3 additions & 0 deletions packages/core-js/actual/array/virtual/unshift.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
var parent = require('../../../stable/array/virtual/unshift');

module.exports = parent;
3 changes: 3 additions & 0 deletions packages/core-js/actual/instance/push.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
var parent = require('../../stable/instance/push');

module.exports = parent;
3 changes: 3 additions & 0 deletions packages/core-js/actual/instance/unshift.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
var parent = require('../../stable/instance/push');

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

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

module.exports = entryVirtual('Array').unshift;
9 changes: 9 additions & 0 deletions packages/core-js/es/instance/push.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
var isPrototypeOf = require('../../internals/object-is-prototype-of');
var method = require('../array/virtual/push');

var ArrayPrototype = Array.prototype;

module.exports = function (it) {
var own = it.push;
return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.push) ? method : own;
};
9 changes: 9 additions & 0 deletions packages/core-js/es/instance/unshift.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
var isPrototypeOf = require('../../internals/object-is-prototype-of');
var method = require('../array/virtual/unshift');

var ArrayPrototype = Array.prototype;

module.exports = function (it) {
var own = it.unshift;
return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.unshift) ? method : own;
};
3 changes: 3 additions & 0 deletions packages/core-js/full/array/unshift.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
var parent = require('../../actual/array/unshift');

module.exports = parent;
3 changes: 3 additions & 0 deletions packages/core-js/full/array/virtual/unshift.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
var parent = require('../../../actual/array/virtual/unshift');

module.exports = parent;
3 changes: 3 additions & 0 deletions packages/core-js/full/instance/push.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
var parent = require('../../actual/instance/push');

module.exports = parent;
3 changes: 3 additions & 0 deletions packages/core-js/full/instance/unshift.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
var parent = require('../../actual/instance/push');

module.exports = parent;
3 changes: 3 additions & 0 deletions packages/core-js/stable/array/unshift.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
var parent = require('../../es/array/unshift');

module.exports = parent;
3 changes: 3 additions & 0 deletions packages/core-js/stable/array/virtual/unshift.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
var parent = require('../../../es/array/virtual/unshift');

module.exports = parent;
3 changes: 3 additions & 0 deletions packages/core-js/stable/instance/push.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
var parent = require('../../es/instance/push');

module.exports = parent;
3 changes: 3 additions & 0 deletions packages/core-js/stable/instance/unshift.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
var parent = require('../../es/instance/push');

module.exports = parent;
14 changes: 14 additions & 0 deletions tests/commonjs.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ for (PATH of ['core-js-pure', 'core-js']) {
ok(typeof load(NS, 'array/reverse') == 'function');
ok(typeof load(NS, 'array/index-of') == 'function');
ok(typeof load(NS, 'array/last-index-of') == 'function');
ok(typeof load(NS, 'array/unshift') == 'function');
ok(load(NS, 'array/concat')([1, 2, 3], [4, 5, 6]).length === 6);
ok(load(NS, 'array/copy-within')([1, 2, 3, 4, 5], 0, 3)[0] === 4);
ok('next' in load(NS, 'array/entries')([]));
Expand Down Expand Up @@ -108,6 +109,7 @@ for (PATH of ['core-js-pure', 'core-js']) {
ok(typeof load(NS, 'array/virtual/reverse') == 'function');
ok(typeof load(NS, 'array/virtual/index-of') == 'function');
ok(typeof load(NS, 'array/virtual/last-index-of') == 'function');
ok(typeof load(NS, 'array/virtual/unshift') == 'function');
ok(load(NS, 'array/virtual/concat').call([1, 2, 3], [4, 5, 6]).length === 6);
ok(load(NS, 'array/virtual/copy-within').call([1, 2, 3, 4, 5], 0, 3)[0] === 4);
ok('next' in load(NS, 'array/virtual/entries').call([]));
Expand Down Expand Up @@ -467,6 +469,12 @@ for (PATH of ['core-js-pure', 'core-js']) {
ok(typeof instancePadStart('') == 'function');
ok(instancePadStart('').call('a', 3, 'b') === 'bba');

const instancePush = load(NS, 'instance/push');
ok(typeof instancePush == 'function');
ok(instancePush({}) === undefined);
ok(typeof instancePush([]) == 'function');
ok(instancePush([]).call([1], 8) === 2);

const instanceReduceRight = load(NS, 'instance/reduce-right');
ok(typeof instanceReduceRight == 'function');
ok(instanceReduceRight({}) === undefined);
Expand Down Expand Up @@ -553,6 +561,12 @@ for (PATH of ['core-js-pure', 'core-js']) {
ok(typeof instanceTrim('') == 'function');
ok(instanceTrim('').call(' 1 ') === '1');

const instanceUnshift = load(NS, 'instance/unshift');
ok(typeof instanceUnshift == 'function');
ok(instanceUnshift({}) === undefined);
ok(typeof instanceUnshift([]) == 'function');
ok(instanceUnshift([]).call([1], 8) === 2);

const instanceValues = load(NS, 'instance/values');
ok(typeof instanceValues == 'function');
ok(instanceValues({}) === undefined);
Expand Down

0 comments on commit f719025

Please sign in to comment.