Added AMD and CommonJS Support. I had to restructure a lot of code to bring the ScaledJS Code in a suitable IIFE(Immediately-Invoked Function Expression) format which helped a lot towards making sure only a few variables are exposed globally and keeping the rest temporary junk inside my libraries.

Also learnt a lot regarding how to manage modules by defining a root and a factory (which is basically your function constructor)

I referred this blog and a couple of others as well as UnderscoreJS’s Git repo where they actually defined such similar definitions.

As you can see in those line it’s that place where they define their root.

var root = typeof self == 'object' && self.self === self && self || typeof global == 'object' && global.global === global && global || this;

Now if we scroll down:

// the browser, add `_` as a global object.
if (typeof exports != 'undefined') {
	if (typeof module != 'undefined' && module.exports) {
		exports = module.exports = _;
	}
	exports._ = _;
} else {
	root._ = _;
}

This is where Underscore.js Binds itself to nodejs 

exports = module.exports = _;

So, I basically understood how module works for CommonJS. Similarly there was an identical approach for AMD (Asynchronous Module Definitions) that’s used by RequireJS.