diff options
-rw-r--r-- | lib/npm.js | 2 | ||||
-rw-r--r-- | lib/utils/get.js | 6 | ||||
-rw-r--r-- | lib/utils/set.js | 25 |
3 files changed, 0 insertions, 33 deletions
diff --git a/lib/npm.js b/lib/npm.js index 1defb883b..20f910c58 100644 --- a/lib/npm.js +++ b/lib/npm.js @@ -17,8 +17,6 @@ require("path").SPLIT_CHAR = process.platform === "win32" ? "\\" : "/" var EventEmitter = require("events").EventEmitter , npm = module.exports = new EventEmitter , config = require("./config.js") - , set = require("./utils/set.js") - , get = require("./utils/get.js") , ini = require("./utils/ini.js") , log = require("./utils/log.js") , fs = require("graceful-fs") diff --git a/lib/utils/get.js b/lib/utils/get.js deleted file mode 100644 index 3c5e4f099..000000000 --- a/lib/utils/get.js +++ /dev/null @@ -1,6 +0,0 @@ - -module.exports = get -function get (obj, key) { - for (var i in obj) if (i.toLowerCase() === key.toLowerCase()) return obj[i] - return undefined -} diff --git a/lib/utils/set.js b/lib/utils/set.js deleted file mode 100644 index 4d9241aab..000000000 --- a/lib/utils/set.js +++ /dev/null @@ -1,25 +0,0 @@ - -module.exports = set -var get = require("./get.js") - , processJson = require("./read-json.js").processJson -function set (obj, key, val) { - for (var i in obj) { - if (i.toLowerCase() === key.toLowerCase()) return obj[i] = val - } - obj[key] = val - if (!val) return - // if it's a package set, then assign all the versions. - if (val.versions) return Object.keys(val.versions).forEach(function (v) { - if (typeof val.versions[v] !== "object") return - set(obj, key+"@"+v, val.versions[v]) - }) - // Note that this doesn't put the dist-tags there, only updates the versions - if (key === val.name+"@"+val.version) { - processJson(val) - var reg = get(obj, val.name) || {} - reg.name = reg._id = val.name - set(obj, val.name, reg) - reg.versions = get(reg, "versions") || {} - if (!get(reg.versions, val.version)) set(reg.versions, val.version, val) - } -} |