@typed/test
Version:
Testing made simple.
26 lines • 972 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const collectByKey_1 = require("../common/collectByKey");
const flatten_1 = require("../common/flatten");
class Results {
constructor() {
this.resultsMap = new Map();
this.getResults = () => {
return flatten_1.flatten(Array.from(this.resultsMap.values()));
};
this.updateResults = (results) => {
const resultsByFilePath = collectByKey_1.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();
};
}
}
exports.Results = Results;
//# sourceMappingURL=Results.js.map