Skip to content

Commit

Permalink
[Fix] avoid mutating Object.assign in modern engines
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Sep 11, 2020
1 parent d15db5f commit fc41c80
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
'use strict';

var defineProperties = require('define-properties');
var callBind = require('es-abstract/helpers/callBind');

var implementation = require('./implementation');
var getPolyfill = require('./polyfill');
var shim = require('./shim');

var polyfill = getPolyfill();
var polyfill = callBind.apply(getPolyfill());
// eslint-disable-next-line no-unused-vars
var bound = function assign(target, source1) {
return polyfill(Object, arguments);
};

defineProperties(polyfill, {
defineProperties(bound, {
getPolyfill: getPolyfill,
implementation: implementation,
shim: shim
});

module.exports = polyfill;
module.exports = bound;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"license": "MIT",
"main": "index.js",
"scripts": {
"pretest": "npm run --silent lint && es-shim-api",
"pretest": "npm run --silent lint && es-shim-api --bound",
"test": "npm run --silent tests-only",
"posttest": "aud --production",
"tests-only": "npm run --silent test:implementation && npm run --silent test:shim",
Expand Down

0 comments on commit fc41c80

Please sign in to comment.