Skip to content

Commit 12afdf2

Browse files
authored
fix: faster for loop (#11)
1 parent 44ba4e6 commit 12afdf2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/pico.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ export const Pico = (): PicoType => {
88
} = {
99
fetch: (req, env, executionContext) => {
1010
const m = req.method
11-
for (const route of routes) {
11+
for (let i = 0, len = routes.length; i < len; i++) {
12+
const route = routes[i]
1213
const result = route.p.exec(req.url)
13-
if ((result && route.m === 'ALL') || (result && route.m === m)) {
14+
if ((result && route.m === 'ALL') || (result && route.m === m))
1415
return route.h({
1516
req,
1617
env,
1718
executionContext,
1819
result,
1920
})
20-
}
2121
}
2222
},
2323
on: (method, path, handler) => {

0 commit comments

Comments
 (0)