Skip to content

Commit 0beedd8

Browse files
committed
style(routing): format Handler implementation 🍞
- Add parentheses around middleware filter predicate - Adjust workerPool/viewEngine conditional formatting - Fix Promise resolver arrow function formatting
1 parent 608cb3f commit 0beedd8

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/routing/Handler.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ export class Handler {
5454
this.maxUrlLength = options?.maxUrlLength ?? Handler.defaultMaxUrlLength
5555
this.maxRouteParamLength = options?.maxRouteParamLength ?? Handler.defaultMaxRouteParamLength
5656
this.requestTimeoutMs = options?.requestTimeoutMs
57-
this.workerPool =
58-
options?.worker !== undefined ? Core.Worker.createPool(options.worker) : undefined
59-
this.viewEngine =
60-
options?.viewsDir !== undefined
61-
? new Rendering.Engine({ viewsDir: options.viewsDir })
62-
: undefined
57+
this.workerPool = options?.worker !== undefined
58+
? Core.Worker.createPool(options.worker)
59+
: undefined
60+
this.viewEngine = options?.viewsDir !== undefined
61+
? new Rendering.Engine({ viewsDir: options.viewsDir })
62+
: undefined
6363
}
6464

6565
/**
@@ -165,7 +165,7 @@ export class Handler {
165165
const timeoutMs = this.requestTimeoutMs
166166
return async (req: Request) => {
167167
if (timeoutMs !== undefined && timeoutMs > 0) {
168-
const timeoutResponse = new Promise<Response>(resolve => {
168+
const timeoutResponse = new Promise<Response>((resolve) => {
169169
setTimeout(
170170
() => resolve(new Response(null, { status: 503, statusText: 'Service Unavailable' })),
171171
timeoutMs
@@ -285,7 +285,7 @@ export class Handler {
285285
ctx: Core.Context,
286286
pathname: string
287287
): Promise<Response | undefined> {
288-
const applicableMiddlewares = this.entryMiddleware.filter(middlewareEntry => {
288+
const applicableMiddlewares = this.entryMiddleware.filter((middlewareEntry) => {
289289
if (middlewareEntry.path === '' || middlewareEntry.path === '*') {
290290
return true
291291
}

0 commit comments

Comments
 (0)