src: use validate_ascii_with_errors instead of validate_ascii

It has better performance

PR-URL: https://github.com/nodejs/node/pull/61122
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Daniel Lemire <daniel@lemire.me>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
This commit is contained in:
Nikita Skovoroda authored and Antoine du Hamel committed 2026-04-10 14:52:16 +02:00
1 parent 6f93c4b287
commit 79fb8cbcf5
1 file changed
+2 -1
+2 -1
View File
@@ -1252,7 +1252,8 @@ static void IsAscii(const FunctionCallbackInfo<Value>& args) {
env, "Cannot validate on a detached buffer");
}
args.GetReturnValue().Set(simdutf::validate_ascii(abv.data(), abv.length()));
args.GetReturnValue().Set(
!simdutf::validate_ascii_with_errors(abv.data(), abv.length()).error);
}
void SetBufferPrototype(const FunctionCallbackInfo<Value>& args) {