1
0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-11-13 03:35:52 +01:00
verdaccio/lib/storage.js
2013-05-31 10:26:11 +04:00

28 lines
557 B
JavaScript

var packages = {};
module.exports.create_package = function(name, metadata, callback) {
if (packages[name] == null) {
packages[name] = {
meta: metadata,
versions: {},
};
callback(null, true);
} else {
callback(null, false);
}
}
module.exports.add_version = function(name, version, metadata, callback) {
if (packages[name] == null) {
callback(null, false);
} else {
packages[name].versions[version] = metadata;
callback(null, true);
}
}
module.exports.get_package = function(name, callback) {
callback(null, packages[name]);
}