'use strict';

var _ = require('underscore');

module.exports = function extend (Superclass, prototypeFragment) {
    prototypeFragment = prototypeFragment || {};

    var Subclass = function () {
        if (_.isFunction(prototypeFragment.initialize)) {
            prototypeFragment.initialize.apply(this, arguments);
        } else {
            Superclass.apply(this, arguments);
        }
    };
    Subclass.prototype = Object.create(Superclass.prototype);
    _.extend(Subclass.prototype, prototypeFragment);

    return Subclass;
};

'use strict';

var _ = require('underscore');

module.exports = function extend (Superclass, prototypeFragment) {
    prototypeFragment = prototypeFragment || {};

    var Subclass = function () {
        Superclass.apply(this, arguments);
        if (_.isFunction(prototypeFragment.initialize)) {
            prototypeFragment.initialize.apply(this, arguments);
        }
    };
    Subclass.prototype = Object.create(Superclass.prototype);
    _.extend(Subclass.prototype, prototypeFragment);

    return Subclass;
};

Fix the issue by calling constructor and checking for initialize
[Green] Fix the issue by calling constructor and checking for initialize
