Skip to content

Commit bf24628

Browse files
committed
perf: optimize toASCIILower function using V8's native toLowerCase
1 parent b1c01fc commit bf24628

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

lib/internal/mime.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,7 @@ const END_BEGINNING_WHITESPACE = /[^\r\n\t ]|$/;
2323
const START_ENDING_WHITESPACE = /[\r\n\t ]*$/;
2424

2525
function toASCIILower(str) {
26-
let result = '';
27-
for (let i = 0; i < str.length; i++) {
28-
const char = str[i];
29-
30-
result += char >= 'A' && char <= 'Z' ?
31-
StringPrototypeToLowerCase(char) :
32-
char;
33-
}
34-
return result;
26+
return StringPrototypeToLowerCase(str);
3527
}
3628

3729
const SOLIDUS = '/';

0 commit comments

Comments
 (0)