util: optimize toASCIILower function using V8s native toLowerCase
Some checks are pending
Coverage Linux (without intl) / coverage-linux-without-intl (push) Waiting to run
Coverage Linux / coverage-linux (push) Waiting to run
Coverage Windows / coverage-windows (push) Waiting to run
Test and upload documentation to artifacts / build-docs (push) Waiting to run
Linters / lint-addon-docs (push) Waiting to run
Linters / lint-cpp (push) Waiting to run
Linters / format-cpp (push) Waiting to run
Linters / lint-js-and-md (push) Waiting to run
Linters / lint-nix (push) Waiting to run
Linters / lint-py (push) Waiting to run
Linters / lint-yaml (push) Waiting to run
Linters / lint-sh (push) Waiting to run
Linters / lint-codeowners (push) Waiting to run
Linters / lint-pr-url (push) Waiting to run
Linters / lint-readme (push) Waiting to run
Notify on Push / Notify on Force Push on `main` (push) Waiting to run
Notify on Push / Notify on Push on `main` with invalid message (push) Waiting to run
Scorecard supply-chain security / Scorecard analysis (push) Waiting to run

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:
Mert Can Altin 2025-12-27 03:40:39 +03:00 committed by GitHub
parent 36ffbc5357
commit ed47077736
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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];