Skip to content

Commit cae4add

Browse files
refactor: address comments.
1 parent e2d95e7 commit cae4add

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

src/modules/github-pr-drawer.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ const defaultCommitMessage = 'chore: sync editor updates from @knighted/develop'
2727
const supportedRenderModes = new Set(['dom', 'react'])
2828
const supportedStyleModes = new Set(['css', 'module', 'less', 'sass'])
2929

30+
const toSafeText = value => (typeof value === 'string' ? value.trim() : '')
31+
3032
const normalizeRenderMode = value => {
3133
const mode = toSafeText(value).toLowerCase()
3234
return supportedRenderModes.has(mode) ? mode : 'dom'
@@ -160,8 +162,7 @@ export const findRepositoryWithActivePrContext = repositories => {
160162
}
161163

162164
for (const repository of repositories) {
163-
const repositoryFullName =
164-
typeof repository?.fullName === 'string' ? repository.fullName.trim() : ''
165+
const repositoryFullName = toSafeText(repository?.fullName)
165166

166167
if (!repositoryFullName) {
167168
continue
@@ -175,8 +176,6 @@ export const findRepositoryWithActivePrContext = repositories => {
175176
return null
176177
}
177178

178-
const toSafeText = value => (typeof value === 'string' ? value.trim() : '')
179-
180179
const normalizeFilePath = value =>
181180
toSafeText(value).replace(/\\/g, '/').replace(/\/+/g, '/')
182181

0 commit comments

Comments
 (0)