Simplify truthiness check

This commit is contained in:
Justin Hutchings
2024-03-12 21:49:01 +00:00
parent 72666694f0
commit f875e6ec1d
3 changed files with 5 additions and 17 deletions

View File

@@ -18,22 +18,14 @@ export async function getScorecardLevels(
}
// If GitHub API doesn't have the repository URL, query deps.dev for it.
if (
repositoryUrl === null ||
repositoryUrl === undefined ||
repositoryUrl === ''
) {
if (repositoryUrl) {
// Call the deps.dev API to get the repository URL from there
repositoryUrl = await getProjectUrl(ecosystem, packageName, version)
}
// Get the scorecard API response from the scorecards API
let scorecardApi: ScorecardApi | null = null
if (
repositoryUrl !== null &&
repositoryUrl !== undefined &&
repositoryUrl !== ''
) {
if (repositoryUrl) {
try {
scorecardApi = await getScorecard(repositoryUrl)
} catch (error: unknown) {