Skip to content

Commit

Permalink
[Fix] ensure main entry point properly checks the receiver in ES3 eng…
Browse files Browse the repository at this point in the history
…ines
  • Loading branch information
ljharb committed May 3, 2022
1 parent 69a56ce commit bb1983d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
9 changes: 9 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@

"extends": "@ljharb",

"rules": {
"id-length": "off",
"new-cap": ["error", {
"capIsNewExceptions": [
"RequireObjectCoercible",
],
}],
},

"overrides": [
{
"files": "test/**",
Expand Down
9 changes: 7 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,22 @@

var callBind = require('call-bind');
var define = require('define-properties');
var RequireObjectCoercible = require('es-abstract/2021/RequireObjectCoercible');

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

var bound = callBind(getPolyfill());
var boundMethod = function trim(receiver) {
RequireObjectCoercible(receiver);
return bound(receiver);
};

define(bound, {
define(boundMethod, {
getPolyfill: getPolyfill,
implementation: implementation,
shim: shim
});

module.exports = bound;
module.exports = boundMethod;
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
},
"dependencies": {
"call-bind": "^1.0.2",
"define-properties": "^1.1.3"
"define-properties": "^1.1.3",
"es-abstract": "^1.19.5"
}
}

0 comments on commit bb1983d

Please sign in to comment.