mirror of
https://github.com/atlanticbiomedical/biomedjs.git
synced 2025-07-02 00:47:26 -04:00
more work
This commit is contained in:
23
node_modules/lodash/internal/createCtorWrapper.js
generated
vendored
Normal file
23
node_modules/lodash/internal/createCtorWrapper.js
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
var baseCreate = require('./baseCreate'),
|
||||
isObject = require('../lang/isObject');
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
function createCtorWrapper(Ctor) {
|
||||
return function() {
|
||||
var thisBinding = baseCreate(Ctor.prototype),
|
||||
result = Ctor.apply(thisBinding, arguments);
|
||||
|
||||
// Mimic the constructor's `return` behavior.
|
||||
// See https://es5.github.io/#x13.2.2 for more details.
|
||||
return isObject(result) ? result : thisBinding;
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = createCtorWrapper;
|
Reference in New Issue
Block a user