From 24220c49dcb7055b5b94eb52c4d610428e19d3e4 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Sat, 23 Apr 2022 21:18:49 -0700 Subject: [PATCH] [Fix] ensure main entry point properly checks the receiver in ES3 engines --- index.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 7c882b7..7aa6140 100644 --- a/index.js +++ b/index.js @@ -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 boundTrim = callBind(getPolyfill()); +var bound = callBind(getPolyfill()); +var boundMethod = function trim(receiver) { + RequireObjectCoercible(receiver); + return bound(receiver); +}; -define(boundTrim, { +define(boundMethod, { getPolyfill: getPolyfill, implementation: implementation, shim: shim }); -module.exports = boundTrim; +module.exports = boundMethod;