In Node.js I can use a module like this:
sys = require("sys");
How do I create my own module like "sys" so that I can require it from other files?
In Node.js I can use a module like this:
sys = require("sys");
How do I create my own module like "sys" so that I can require it from other files?
You probably want to look into CommonJS http://www.commonjs.org/. Node follows this protocol for require(). Some of the documentation on CommonJS describes projects that implement this in the browser.
The API contains an example of writing your own module: http://nodejs.org/api.html#modules-312