Skip to content

Commit

Permalink
Merge pull request #58 from nigrosimone/main
Browse files Browse the repository at this point in the history
perf: micro-optimization avoid multiple call to map
  • Loading branch information
dimdenGD authored Nov 17, 2024
2 parents 7ff6a36 + 50e6706 commit 5d68ff6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -386,10 +386,10 @@ module.exports = class Router extends EventEmitter {
if(this._paramCallbacks.size > 0) {
return new Promise(async resolve => {
for(let param in req.params) {
if(this._paramCallbacks.has(param) && !req._gotParams.has(param)) {
const pcs = this._paramCallbacks.get(param);
if(pcs && !req._gotParams.has(param)) {
req._gotParams.add(param);
const pcs = this._paramCallbacks.get(param);
for(let i = 0; i < pcs.length; i++) {
for(let i = 0, len = pcs.length; i < len; i++) {
const fn = pcs[i];
await new Promise(resolveRoute => {
const next = (thingamabob) => {
Expand Down

0 comments on commit 5d68ff6

Please sign in to comment.