trekjs / router

⚡ A fast HTTP router, inspired by Echo's Router

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A bug in find()

strrchr opened this issue · comments

      n--
        console.log("before", params);
      params.shift()
        console.log("after", params);
      search = preSearch

I think the params.shift() should be params.pop().
shift() will pop from front, and pop() will pop from back.
In this case, I think it should pop from back.
I use the following case for debug:

  ['GET', '/:prefix/people/:userId/activities/:collection', '/xxx/people/377/activities/333'],
  ['GET', '/:prefix/people/*', '/xxx/people/377/activities'],