Skip to content

Commit

Permalink
simplify the statement
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulaBarszcz committed Oct 20, 2022
1 parent a892ef9 commit 57753ff
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions services/github/github-release-date.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,17 +93,10 @@ export default class GithubReleaseDate extends GithubAuthV3Service {
async handle({ variant, user, repo }, queryParams) {
const body = await this.fetch({ variant, user, repo })
if (Array.isArray(body)) {
if (queryParams.display_date === 'published_at') {
return this.constructor.render({ date: body[0].published_at })
}

return this.constructor.render({ date: body[0].created_at })
}

if (queryParams.display_date === 'published_at') {
return this.constructor.render({ date: body.published_at })
return this.constructor.render({
date: body[0][queryParams.display_date],
})
}

return this.constructor.render({ date: body.created_at })
return this.constructor.render({ date: body[queryParams.display_date] })
}
}

0 comments on commit 57753ff

Please sign in to comment.