Skip to content

Commit

Permalink
some stylistic changes, improve a note
Browse files Browse the repository at this point in the history
  • Loading branch information
zloirock committed Oct 1, 2022
1 parent afcc148 commit fd7812a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion 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

Expand Down
13 changes: 5 additions & 8 deletions 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;
};

0 comments on commit fd7812a

Please sign in to comment.