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