Skip to content

Commit

Permalink
refactor: compare with undefined directly (#3602)
Browse files Browse the repository at this point in the history
  • Loading branch information
exoego authored Nov 1, 2024
1 parent c88ead6 commit 1af7e58
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/router/reg-exp-router/trie.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ export class Trie {
const paramReplacementMap: ReplacementMap = []

regexp = regexp.replace(/#(\d+)|@(\d+)|\.\*\$/g, (_, handlerIndex, paramIndex) => {
if (typeof handlerIndex !== 'undefined') {
if (handlerIndex !== undefined) {
indexReplacementMap[++captureIndex] = Number(handlerIndex)
return '$()'
}
if (typeof paramIndex !== 'undefined') {
if (paramIndex !== undefined) {
paramReplacementMap[Number(paramIndex)] = ++captureIndex
return ''
}
Expand Down
2 changes: 1 addition & 1 deletion src/utils/color.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export function getColorEnabled(): boolean {
const isNoColor =
typeof Deno?.noColor === 'boolean'
? (Deno.noColor as boolean)
: typeof process !== 'undefined'
: process !== undefined
? // eslint-disable-next-line no-unsafe-optional-chaining
'NO_COLOR' in process?.env
: false
Expand Down

0 comments on commit 1af7e58

Please sign in to comment.