* Creates a function that produces an instance of `Ctor` regardless of * whether it was invoked as part of a `new` expression or by `call` or `apply`. * * @private * @param {Function} Ctor The constructor to wrap. * @returns {Function} Returns the new wrapped function.
(Ctor)
| 4719 | * @returns {Function} Returns the new wrapped function. |
| 4720 | */ |
| 4721 | function createCtorWrapper(Ctor) { |
| 4722 | return function() { |
| 4723 | var thisBinding = baseCreate(Ctor.prototype), |
| 4724 | result = Ctor.apply(thisBinding, arguments); |
| 4725 | |
| 4726 | // Mimic the constructor's `return` behavior. |
| 4727 | // See https://es5.github.io/#x13.2.2 for more details. |
| 4728 | return isObject(result) ? result : thisBinding; |
| 4729 | }; |
| 4730 | } |
| 4731 | |
| 4732 | /** |
| 4733 | * Creates a `_.curry` or `_.curryRight` function. |
no test coverage detected