2019-12-14 22:52:26 +01:00
|
|
|
const namespace = Object.create(null);
|
2020-12-21 10:22:06 +01:00
|
|
|
import buildDebug from 'debug';
|
|
|
|
|
|
|
|
const debug = buildDebug('verdaccio:e2e:global');
|
2019-12-14 22:52:26 +01:00
|
|
|
|
2020-08-13 23:36:23 +02:00
|
|
|
exports.addItem = function (name, value) {
|
2019-12-14 22:52:26 +01:00
|
|
|
namespace[name] = value;
|
2020-08-13 23:36:23 +02:00
|
|
|
};
|
2019-12-14 22:52:26 +01:00
|
|
|
|
2020-08-13 23:36:23 +02:00
|
|
|
exports.getItem = function (name) {
|
2020-12-21 10:22:06 +01:00
|
|
|
debug('get-item %o:%o', name, namespace);
|
2019-12-14 22:52:26 +01:00
|
|
|
if (!(name in namespace)) {
|
2020-08-13 23:36:23 +02:00
|
|
|
throw new Error('The item '.concat(name, ' does exist in the namespace'));
|
2019-12-14 22:52:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return namespace[name];
|
2020-08-13 23:36:23 +02:00
|
|
|
};
|