JSFiddle - React, Tailwind, and code Playground
JavaScript
var ns = {};
(function(ns){
var local = {};
local.func1 = function() {
this.p = "func1";
}
local.func2 = function() {
this.p = "func2";
}
var proto = {
name : "test"
}
for (var prop in local){
if (local.hasOwnProperty(prop) && typeof local[prop] === "function"){
local[prop].prototype = proto
}
}
console.log(new local.func1());
console.log(new local.func2());
}(ns))