1 | ;
|
2 | var uncurryThis = require('../internals/function-uncurry-this-clause');
|
3 | var aCallable = require('../internals/a-callable');
|
4 | var NATIVE_BIND = require('../internals/function-bind-native');
|
5 |
|
6 | var bind = uncurryThis(uncurryThis.bind);
|
7 |
|
8 | // optional / simple context binding
|
9 | module.exports = function (fn, that) {
|
10 | aCallable(fn);
|
11 | return that === undefined ? fn : NATIVE_BIND ? bind(fn, that) : function (/* ...args */) {
|
12 | return fn.apply(that, arguments);
|
13 | };
|
14 | };
|