lib/index.js
function makeInstance(constructor, constructorOpt, args) {
    // pass args to the constructor
    function F() { // eslint-disable-line require-jsdoc
        return constructor.apply(this, args);
    }
    F.prototype = constructor.prototype;

    // new up an instance, and capture stack trace from the
    // passed in constructorOpt
    var errInstance = new F();
    Error.captureStackTrace(errInstance, constructorOpt);

    // return the error instance
    return errInstance;
}
function makeInstance(constructor, constructorOpt, args) {
    // pass args to the constructor
    function F() { // eslint-disable-line require-jsdoc
        return constructor.apply(this, args);
    }
    F.prototype = constructor.prototype;

    // new up an instance, and capture stack trace from the
    // passed in constructorOpt
    var errInstance = new F();
    Error.captureStackTrace(errInstance, constructorOpt);

    // return the error instance
    return errInstance;
}
function makeInstance ( constructor , constructorOpt , args ) { // pass args to the constructor function F ( ) { // eslint-disable-line require-jsdoc return constructor . apply ( this , args ) ; } F . prototype = constructor . prototype ; // new up an instance, and capture stack trace from the // passed in constructorOpt var errInstance = new F ( ) ; Error . captureStackTrace ( errInstance , constructorOpt ) ; // return the error instance return errInstance ; }
helper function to dynamically apply args
to a dynamic constructor. magicks.
@private
@function makeInstance
@param    {Function} constructor    the constructor function
@param    {Function} constructorOpt where to start the error stack trace
@param    {Array}    args           array of arguments to apply to ctor
@returns  {Object}                  instance of the ctor
helper function to dynamically apply args to a dynamic constructor . magicks .