I ran across sim.js, a library for discrete event simulation, and I thought it would be fun to use while learning node.js. It's a single javascript file, with no dependencies on other libraries or the browser.
What's the best practice for including this in my code base? Save the .js to disk, and convert it to a standard node module?
I.e.:
// ---sim.js
var Sim = function () {
this.simTime = 0;
this.entities = [];
}
Sim.Event = function (name) {
this.name = name;
};
// ... functions continue
module.exports = Sim;
// --- main.js
var Sim = require('./sim');
var sim = new Sim();
var trafficLights = [new Sim.Event("North-South Light"),
new Sim.Event("East-West Light")];
Or is there an easier way that would not require modifying/modularizing the original js?