Skip to content

Commit

Permalink
[Refactor] use call-bound directly; use es-object-atoms
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Dec 12, 2024
1 parent 6b7486b commit 9b0c60c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
12 changes: 6 additions & 6 deletions implementation.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,25 @@
// modified from https://github.com/es-shims/es6-shim
var objectKeys = require('object-keys');
var hasSymbols = require('has-symbols/shams')();
var callBound = require('call-bind/callBound');
var toObject = Object;
var callBound = require('call-bound');
var $Object = require('es-object-atoms');
var $push = callBound('Array.prototype.push');
var $propIsEnumerable = callBound('Object.prototype.propertyIsEnumerable');
var originalGetSymbols = hasSymbols ? Object.getOwnPropertySymbols : null;
var originalGetSymbols = hasSymbols ? $Object.getOwnPropertySymbols : null;

// eslint-disable-next-line no-unused-vars
module.exports = function assign(target, source1) {
if (target == null) { throw new TypeError('target must be an object'); }
var to = toObject(target); // step 1
var to = $Object(target); // step 1
if (arguments.length === 1) {
return to; // step 2
}
for (var s = 1; s < arguments.length; ++s) {
var from = toObject(arguments[s]); // step 3.a.i
var from = $Object(arguments[s]); // step 3.a.i

// step 3.a.ii:
var keys = objectKeys(from);
var getSymbols = hasSymbols && (Object.getOwnPropertySymbols || originalGetSymbols);
var getSymbols = hasSymbols && ($Object.getOwnPropertySymbols || originalGetSymbols);
if (getSymbols) {
var syms = getSymbols(from);
for (var j = 0; j < syms.length; ++j) {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
],
"dependencies": {
"call-bind": "^1.0.8",
"call-bound": "^1.0.2",
"define-properties": "^1.2.1",
"has-symbols": "^1.1.0",
"object-keys": "^1.1.1"
Expand Down

0 comments on commit 9b0c60c

Please sign in to comment.