diff --git a/CHANGELOG.md b/CHANGELOG.md index c6dcb7c47494..e837f53800cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ ## Changelog ##### Unreleased -- Added a workaround of a Nashorn bug with `Function.prototype.{ call, bind }`, [#1128](https://github.com/zloirock/core-js/issues/1128) +- Added a workaround of a Nashorn bug with `Function.prototype.{ call, apply, bind }` on string methods, [#1128](https://github.com/zloirock/core-js/issues/1128) - `Array.prototype.{ group, groupToMap }` marked as [supported from V8 ~ Chromium 108](https://chromestatus.com/feature/5714791975878656) - Added Electron 22 compat data mapping diff --git a/packages/core-js/internals/function-uncurry-this.js b/packages/core-js/internals/function-uncurry-this.js index 42d5d48bc047..174ce8192a0c 100644 --- a/packages/core-js/internals/function-uncurry-this.js +++ b/packages/core-js/internals/function-uncurry-this.js @@ -1,19 +1,16 @@ var NATIVE_BIND = require('../internals/function-bind-native'); -var FunctionPrototype = Function.prototype; +var $Function = Function; +var FunctionPrototype = $Function.prototype; var bind = FunctionPrototype.bind; var call = FunctionPrototype.call; var uncurryThis = NATIVE_BIND && bind.bind(call, call); module.exports = function (fn) { - var isNativeFunction = fn instanceof Function; // Nashorn bug: // https://github.com/zloirock/core-js/issues/1128 // https://github.com/zloirock/core-js/issues/1130 - if (!isNativeFunction) return; - return NATIVE_BIND - ? uncurryThis(fn) - : function () { - return call.apply(fn, arguments); - }; + return fn instanceof $Function ? NATIVE_BIND ? uncurryThis(fn) : function () { + return call.apply(fn, arguments); + } : undefined; };