Skip to content

Commit f11c0ab

Browse files
committed
src: use validate_ascii_with_errors instead of validate_ascii
It has better performance
1 parent 6682787 commit f11c0ab

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/node_buffer.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1252,7 +1252,8 @@ static void IsAscii(const FunctionCallbackInfo<Value>& args) {
12521252
env, "Cannot validate on a detached buffer");
12531253
}
12541254

1255-
args.GetReturnValue().Set(simdutf::validate_ascii(abv.data(), abv.length()));
1255+
args.GetReturnValue().Set(
1256+
!simdutf::validate_ascii_with_errors(abv.data(), abv.length()).error);
12561257
}
12571258

12581259
void SetBufferPrototype(const FunctionCallbackInfo<Value>& args) {

0 commit comments

Comments
 (0)