Commit 229681b7 authored by mo khan's avatar mo khan

Rename class to better match intention

parent 229c2efc
import { byLicenseNameComparator } from './store/utils'; import { byLicenseNameComparator } from './store/utils';
class V2ToV1Mapper { class V2Report {
mapFrom(report) { constructor(report) {
this.licenseMap = V2ToV1Mapper.createLicenseMap(report.licenses); this.report = report;
this.licenses = report.licenses.sort(byLicenseNameComparator).map(V2ToV1Mapper.mapFromLicense); this.licenseMap = V2Report.createLicenseMap(report.licenses);
this.licenses = report.licenses.sort(byLicenseNameComparator).map(V2Report.mapFromLicense);
}
toV1Schema() {
return { return {
licenses: this.licenses, licenses: this.licenses,
dependencies: report.dependencies.map(v2Dependency => this.mapFromDependency(v2Dependency)), dependencies: this.report.dependencies.map(v2Dependency =>
this.mapFromDependency(v2Dependency),
),
}; };
} }
...@@ -63,7 +68,7 @@ export default class ReportMapper { ...@@ -63,7 +68,7 @@ export default class ReportMapper {
constructor() { constructor() {
this.mappers = { this.mappers = {
'1': report => report, '1': report => report,
'2': report => new V2ToV1Mapper().mapFrom(report), '2': report => new V2Report(report).toV1Schema(),
}; };
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment