Skip to content

Commit b6ef771

Browse files
committed
refactor: use optional chaining
1 parent 22d70dd commit b6ef771

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/codeownersFile.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ const getCodeownersFile = memoizeAsync(
3131
`,
3232
{ repo, rev }
3333
)
34-
if (!data || !data.repository || !data.repository.commit) {
34+
if (!data?.repository?.commit) {
3535
throw new Error('repository or commit not found when getting CODEOWNERS file')
3636
}
37-
if (data.repository.commit.codeownersBlob && data.repository.commit.codeownersBlob.content) {
37+
if (data.repository.commit.codeownersBlob?.content) {
3838
return { path: 'CODEOWNERS', content: data.repository.commit.codeownersBlob.content }
3939
}
40-
if (data.repository.commit.githubCodeownersBlob && data.repository.commit.githubCodeownersBlob.content) {
40+
if (data.repository.commit.githubCodeownersBlob?.content) {
4141
return { path: '.github/CODEOWNERS', content: data.repository.commit.githubCodeownersBlob.content }
4242
}
4343
return null

0 commit comments

Comments
 (0)