import { collectByKey } from '../common/collectByKey';
import { flatten } from '../common/flatten';
export class Results {
    constructor() {
        this.resultsMap = new Map();
        this.getResults = () => {
            return flatten(Array.from(this.resultsMap.values()));
        };
        this.updateResults = (results) => {
            const resultsByFilePath = collectByKey(x => x.filePath, results);
            const filePaths = Object.keys(resultsByFilePath);
            filePaths.forEach(filePath => {
                this.resultsMap.set(filePath, resultsByFilePath[filePath]);
            });
            return this.getResults();
        };
        this.removeFilePath = (filePath) => {
            this.resultsMap.delete(filePath);
            return this.getResults();
        };
    }
}
//# sourceMappingURL=Results.js.map