mirror of
https://github.com/Unleash/unleash.git
synced 2024-10-18 20:09:08 +02:00
18 lines
479 B
JavaScript
18 lines
479 B
JavaScript
|
const NotFoundError = require('../../lib/error/notfound-error');
|
||
|
|
||
|
module.exports = () => {
|
||
|
const _tagTypes = {};
|
||
|
return {
|
||
|
getTagType: async name => {
|
||
|
const tag = _tagTypes[name];
|
||
|
if (tag) {
|
||
|
return Promise.resolve(tag);
|
||
|
}
|
||
|
return Promise.reject(new NotFoundError('Could not find tag type'));
|
||
|
},
|
||
|
createTagType: async tag => {
|
||
|
_tagTypes[tag.name] = tag;
|
||
|
},
|
||
|
};
|
||
|
};
|