0
0
mirror of https://github.com/honojs/hono.git synced 2024-11-21 10:08:58 +01:00

refactor: compare with undefined directly (#3602)

This commit is contained in:
TATSUNO “Taz” Yasuhiro 2024-11-01 10:22:08 +09:00 committed by GitHub
parent c88ead6d72
commit 1af7e58ae0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View File

@ -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 ''
}

View File

@ -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