|
|
|
|
|
by chrismorgan
3261 days ago
|
|
I would have done that, but because of the splicing you don’t actually want ++i every time. That’s why I rewrote it to a while loop. Even then you could do it as a for loop with an empty increment clause, of course. Or even use a one-liner for loop with no body: function blockCookies(details) {
for (var headers = details.responseHeaders, i = headers.length - 1; i > -1; headers[i].name === "Set-Cookie" ? headers.splice(i, 1) : i--);
return {responseHeaders: headers};
}
But that’s crazy talk. Leave optimisations that to the minifier if it feels so disposed. |
|