mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
util: optimize toASCIILower function using V8s native toLowerCase
PR-URL: https://github.com/nodejs/node/pull/61107 Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
@@ -23,6 +23,8 @@ const END_BEGINNING_WHITESPACE = /[^\r\n\t ]|$/;
|
||||
const START_ENDING_WHITESPACE = /[\r\n\t ]*$/;
|
||||
|
||||
function toASCIILower(str) {
|
||||
// eslint-disable-next-line no-control-regex
|
||||
if (!/[^\x00-\x7f]/.test(str)) return StringPrototypeToLowerCase(str);
|
||||
let result = '';
|
||||
for (let i = 0; i < str.length; i++) {
|
||||
const char = str[i];
|
||||
|
||||
Reference in New Issue
Block a user