Commit 18f6a39c authored by mo khan's avatar mo khan

Apply reviewer feedback

parent 43c486b6
...@@ -52,11 +52,9 @@ class V2Report { ...@@ -52,11 +52,9 @@ class V2Report {
} }
static createLicenseMap(licenses) { static createLicenseMap(licenses) {
const reducer = (memo, item) => { const identityMap = {};
memo[item.id] = { name: item.name, url: item.url }; // eslint-disable-line no-param-reassign licenses.forEach(item => (identityMap[item.id] = { name: item.name, url: item.url }));
return memo; return identityMap;
};
return licenses.reduce(reducer, {});
} }
} }
...@@ -71,7 +69,7 @@ export default class ReportMapper { ...@@ -71,7 +69,7 @@ export default class ReportMapper {
} }
mapFrom(reportArtifact) { mapFrom(reportArtifact) {
const majorVersion = ReportMapper.majorVersion(reportArtifact); const majorVersion = ReportMapper.majorVersionFor(reportArtifact);
return this.mapperFor(majorVersion)(reportArtifact); return this.mapperFor(majorVersion)(reportArtifact);
} }
...@@ -79,7 +77,12 @@ export default class ReportMapper { ...@@ -79,7 +77,12 @@ export default class ReportMapper {
return this.mappers[majorVersion]; return this.mappers[majorVersion];
} }
static majorVersion(report) { static majorVersionFor(report) {
return report && report.version ? report.version.split('.')[0] : DEFAULT_VERSION; if (report && report.version) {
const [majorVersion] = report.version.split('.');
return majorVersion;
}
return DEFAULT_VERSION;
} }
} }
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