jest-metadata
Version:
🦸♂️ Superhero power for your Jest reporters! 🦸♀️
25 lines • 698 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ScopedMetadataRegistry = void 0;
class ScopedMetadataRegistry {
scope;
metadata = {};
constructor(scope) {
this.scope = scope;
}
get(id) {
const metadata = this.metadata[id];
if (!metadata) {
throw new Error(`No metadata found in ${this.scope} for id: ${id}`);
}
return this.metadata[id];
}
register(id, metadata) {
this.metadata[id] = metadata;
}
*all() {
yield* Object.values(this.metadata);
}
}
exports.ScopedMetadataRegistry = ScopedMetadataRegistry;
//# sourceMappingURL=ScopedMetadataRegistry.js.map