Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/npm.js
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2010-03-01 14:11:19 +0300
committerisaacs <i@izs.me>2010-03-01 14:11:19 +0300
commit89388fdc46da628b58e128cf16e81e95c3d71f99 (patch)
tree538d142c2cc36e603b8b7539bcf72d7c769abba4 /npm.js
parent368af0cc643adb624e39402c99a887c9087943af (diff)
Dry things up a bit, use "npm" instead of exports since that's nicer.
Diffstat (limited to 'npm.js')
-rwxr-xr-xnpm.js21
1 files changed, 12 insertions, 9 deletions
diff --git a/npm.js b/npm.js
index dfcb3ba56..752a8c9d0 100755
--- a/npm.js
+++ b/npm.js
@@ -7,25 +7,28 @@ if (module.id !== moduleName) {
return;
}
+var npm = exports;
+
var utils = require("./lib/utils");
-exports.moduleName = moduleName;
+npm.moduleName = moduleName;
-exports.install = require("./lib/install");
-exports.activate = require("./lib/activate");
-exports.ls = exports.list = require("./lib/ls");
+["install", "activate", "deactivate", "ls"].forEach(function (c) {
+ npm[c] = require("./lib/"+c);
+});
+npm.list = npm.ls;
var registry = {};
-exports.set = set;
-exports.get = get;
+npm.set = set;
+npm.get = get;
function set (name, data) { return utils.set(registry, name, data) };
function get (name) { return utils.get(registry, name) };
var path = require("path");
-exports.root = path.join(process.env.HOME, ".node_libraries");
-exports.__defineGetter__("dir", function () { return path.join(exports.root, ".npm") });
-exports.__defineGetter__("tmp", function () { return path.join(exports.dir, ".tmp") });
+npm.root = path.join(process.env.HOME, ".node_libraries");
+npm.__defineGetter__("dir", function () { return path.join(npm.root, ".npm") });
+npm.__defineGetter__("tmp", function () { return path.join(npm.dir, ".tmp") });