Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: compare with undefined directly #3602

Merged
merged 1 commit into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading