11'use strict' ;
22var global = require ( '../internals/global' ) ;
33var uncurryThis = require ( '../internals/function-uncurry-this' ) ;
4- var fails = require ( '../internals/fails' ) ;
54var aCallable = require ( '../internals/a-callable' ) ;
65var isObject = require ( '../internals/is-object' ) ;
76var hasOwn = require ( '../internals/has-own-property' ) ;
87var arraySlice = require ( '../internals/array-slice' ) ;
8+ var NATIVE_BIND = require ( '../internals/function-bind-native' ) ;
99
1010var Function = global . Function ;
1111var concat = uncurryThis ( [ ] . concat ) ;
@@ -21,11 +21,7 @@ var construct = function (C, argsLength, args) {
2121
2222// `Function.prototype.bind` method implementation
2323// https://tc39.es/ecma262/#sec-function.prototype.bind
24- module . exports = fails ( function ( ) {
25- // detect broken third-party polyfills
26- var Test = function ( ) { /* empty */ } ;
27- return ! ( new ( Test . bind ( ) ) ( ) instanceof Test ) || ( function ( a , b ) { return this + a + b ; } ) . bind ( 1 , 2 ) ( 3 ) !== 6 ;
28- } ) ? function bind ( that /* , ...args */ ) {
24+ module . exports = NATIVE_BIND ? Function . bind : function bind ( that /* , ...args */ ) {
2925 var F = aCallable ( this ) ;
3026 var Prototype = F . prototype ;
3127 var partArgs = arraySlice ( arguments , 1 ) ;
@@ -35,4 +31,4 @@ module.exports = fails(function () {
3531 } ;
3632 if ( isObject ( Prototype ) ) boundFunction . prototype = Prototype ;
3733 return boundFunction ;
38- } : Function . bind ;
34+ } ;
0 commit comments