2025-07-05 14:49:26 +08:00
|
|
|
'use strict';
|
|
|
|
|
|
2025-12-24 10:52:28 +08:00
|
|
|
/**
|
|
|
|
|
* Create a bound version of a function with a specified `this` context
|
|
|
|
|
*
|
|
|
|
|
* @param {Function} fn - The function to bind
|
|
|
|
|
* @param {*} thisArg - The value to be passed as the `this` parameter
|
|
|
|
|
* @returns {Function} A new function that will call the original function with the specified `this` context
|
|
|
|
|
*/
|
2025-07-05 14:49:26 +08:00
|
|
|
export default function bind(fn, thisArg) {
|
|
|
|
|
return function wrap() {
|
|
|
|
|
return fn.apply(thisArg, arguments);
|
|
|
|
|
};
|
|
|
|
|
}
|