@nodesecure/js-x-ray
Version:
JavaScript AST XRay analysis
20 lines • 681 B
JavaScript
export class CollectableSetRegistry {
#collectableSets = new Map();
constructor(collectableSets) {
collectableSets.forEach((collectableSet) => {
this.#collectableSets.set(collectableSet.type, collectableSet);
});
}
add(type, options) {
const { value, file = null, location, metadata = {} } = options;
const collectableSet = this.#collectableSets.get(type);
collectableSet?.add(value, { file, location, metadata });
}
has(type) {
return this.#collectableSets.has(type);
}
get(type) {
return this.#collectableSets.get(type);
}
}
//# sourceMappingURL=CollectableSetRegistry.js.map