function $(...) { var r = {}; ... for (var i in $.prototype) r[i] = $.prototype[i]; ... } $.prototype.ddd = function () {...};