mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-04 00:57:48 +00:00
Bump to v3.0.0.
This commit is contained in:
21
internal/createBindWrapper.js
Normal file
21
internal/createBindWrapper.js
Normal file
@@ -0,0 +1,21 @@
|
||||
import createCtorWrapper from './createCtorWrapper';
|
||||
|
||||
/**
|
||||
* Creates a function that wraps `func` and invokes it with the `this`
|
||||
* binding of `thisArg`.
|
||||
*
|
||||
* @private
|
||||
* @param {Function} func The function to bind.
|
||||
* @param {*} [thisArg] The `this` binding of `func`.
|
||||
* @returns {Function} Returns the new bound function.
|
||||
*/
|
||||
function createBindWrapper(func, thisArg) {
|
||||
var Ctor = createCtorWrapper(func);
|
||||
|
||||
function wrapper() {
|
||||
return (this instanceof wrapper ? Ctor : func).apply(thisArg, arguments);
|
||||
}
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
export default createBindWrapper;
|
||||
Reference in New Issue
Block a user