JSFiddle - React, Tailwind, and code Playground
JavaScript
var d = function () {
var a = {
ModuleStruct: function (b) {
this.color = void 0 !== b.color ? b.color : null;
this.size = void 0 !== b.size ? b.size : null
}
};
a.ModuleStruct.prototype.clone = function () {
return new a.ModuleStruct({
color: this.color,
size: this.size
})
};
a.a = 1;
a.moduleMethod = function (b) {
var a, c = 0;
for (a = 0; a < b.length; a += 1) c += b[a];
return c
};
return a
}();
window.MATHCALCS = d;
/**
* Code above has been minified with Closure using
* ADVANCED_OPTIMIZATIONS but by using the
* depreicated '@expose' annotation.
*/
// call a public method
alert(MATHCALCS.moduleMethod([1, 2, 3]));
// allocate a new structure
var ms = new MATHCALCS.ModuleStruct({
"color": "red",
"size": "small"
});
alert(ms.color + '\t' + ms.size);
// clone a second instance
var ms2 = ms.clone();
alert(ms2.color + '\t' + ms2.size);
alert(ms !== ms2); // cloned objs are not equal
// and directly update the properties of the object
ms2.color = "white";
ms2.size = "large";
alert(ms2.color + '\t' + ms2.size);