Skip to content

Commit

Permalink
Refactor compileVersionDictionary return statement
Browse files Browse the repository at this point in the history
  • Loading branch information
einbergisak committed Sep 3, 2024
1 parent e362ee9 commit ca51b4e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions verify_dependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,20 +75,20 @@ function compileVersionDictionary(deps: Record<string, string[]>) {
}
}

return Object.entries(versionDictionary)
.filter(([_, versions]) => Object.keys(versions).length > 1)
.reduce<VersionDictionary>((total, current) => {
total[current[0]] = current[1];
return total;
}, {});
// We're interested in deps with multiple versions
return Object.fromEntries(
Object.entries(versionDictionary)
.filter(([_, versions]) => Object.keys(versions).length > 1)
);

}

type FaultReport = Record<string, Record<string, string>>;
function getFaultReport(versionDictionary: VersionDictionary) {
/* example format of fault report
{
<project>: {
<library>: "Has version <version> but should have <version>"
<library>: "Has version <version> but should have <version>"
}
}
*/
Expand Down

0 comments on commit ca51b4e

Please sign in to comment.