Skip to content

Commit

Permalink
[Robustness] use callBind.apply
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Dec 20, 2024
1 parent 5e8dac9 commit 07387b4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,20 @@

var define = require('define-properties');
var RequireObjectCoercible = require('es-object-atoms/RequireObjectCoercible');
var callBind = require('call-bind');
var callBound = require('call-bound');

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

var $slice = callBound('Array.prototype.slice');

// eslint-disable-next-line no-unused-vars
var boundMapShim = function map(array, callbackfn) {
RequireObjectCoercible(array);
return polyfill.apply(array, $slice(arguments, 1));
return polyfill(array, $slice(arguments, 1));
};
define(boundMapShim, {
getPolyfill: getPolyfill,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
},
"homepage": "https://github.com/es-shims/Array.prototype.map#readme",
"dependencies": {
"call-bind": "^1.0.8",
"call-bound": "^1.0.3",
"define-properties": "^1.2.1",
"es-abstract": "^1.23.6",
Expand All @@ -53,7 +54,6 @@
"@es-shims/api": "^2.5.1",
"@ljharb/eslint-config": "^21.1.1",
"auto-changelog": "^2.5.0",
"call-bind": "^1.0.8",
"encoding": "^0.1.13",
"eslint": "=8.8.0",
"evalmd": "^0.0.19",
Expand Down

0 comments on commit 07387b4

Please sign in to comment.