/*! resol-vbus | Copyright (c) 2013-2018, Daniel Wippermann | MIT license */
'use strict';



const _ = require('./lodash');



/**
 * A helper method for classical inheritance.
 *
 * @param {?function} parent Parent class constructor
 * @param {?object} protoProps Properties to be mixed-in the prototype of
 *                             the child class
 * @param {?object} staticProps Properties to be mixed-in the constructor
 *                              function of the child class
 * @returns {function} Child class constructor
 */
const extend = function(parent, protoProps, staticProps) {

    let child;
    if (protoProps && _.has(protoProps, 'constructor')) {
        child = protoProps.constructor;
    } else if (parent) {
        child = function() {
            return parent.apply(this, arguments);
        };
    } else {
        child = function() {
            // nop
        };
    }

    _.extend(child, parent, staticProps);

    const Surrogate = function() {
        this.constructor = child;
    };
    if (parent) {
        Surrogate.prototype = parent.prototype;
    }
    child.prototype = new Surrogate();

    if (protoProps) {
        _.extend(child.prototype, protoProps);
    }

    if (parent) {
        child.__super__ = parent.prototype;
    }

    if (!_.has(child, 'extend')) {
        child.extend = function(protoProps, staticProps) {
            return extend(this, protoProps, staticProps);
        };
    }

    return child;
};



module.exports = extend;

@@ -687,30 +687,98 @@
 d = 
-protoProps.constructor
+function(...args) %7B%0A            return protoProps.constructor.apply(this, args);%0A        %7D
 ;%0A  
@@ -817,32 +817,39 @@
 hild = function(
+...args
 ) %7B%0A            
@@ -881,13 +881,8 @@
  arg
-ument
 s);%0A

Make `extend` work with object literal `constructor` shorthand methods.