I have an object like this:
var source = (function(undefined) {
var o;
function s(o) {
if(!o || typeof o === 'object') {
o = o || {};
o.a = typeof o.a === 'string' ? o.a : 'A';
o.b = typeof o.b === 'string' ? o.b : 'B';
this.o = o;
}
}
s.prototype.v = function() {
// some function
};
s.prototype.x = function() {
// some function
};
return s;
})();
I want to use another similar to extend the first.
var extender = (function(undefined) {
var o;
function e(o) {
if(!o || typeof o === 'object') {
o = o || {};
o.c = typeof o.c === 'number' ? o.c : 3;
o.d = typeof o.d === 'number' ? o.d : 4;
this.o = o;
}
}
e.prototype.y = function(m) {
// some function
};
e.prototype.z = function(m) {
// some function
};
return e;
})();
I can add this.s = new source(o);
to the function and with some small changes to my second object can tie everything into the first but I was thinking there might be a better way.