express
express copied to clipboard
Use loop for acceptParams
Using a loop here would improve performance for parsing over splitting into an array and iterating over it, then splitting some more. If we prefer the overall split on ; for readability though, we can still avoid the second split by using indexOf instead. There's also some slices and trim that could be avoided for extra performance but it seemed a little overkill for this function.
Finally, given the code is only used here: https://github.com/expressjs/express/blob/a46cfdc37f5e422db7ce6f12d321eb79694c1e9b/lib/response.js#L575-L584. If we avoid exporting these utils to users we can just return value only and avoid the rest of the processing entirely.