Skip to content

Commit

Permalink
refactor: compare with undefined directly (honojs#3602)
Browse files Browse the repository at this point in the history
  • Loading branch information
exoego authored and TinsFox committed Nov 11, 2024
1 parent 258ff7d commit 9bc00bd
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 9bc00bd

Please sign in to comment.