Skip to content

Commit e78cdd1

Browse files
committed
src: use validate_ascii_with_errors instead of validate_ascii
It has better performance
1 parent 2e597de commit e78cdd1

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
@@ -1230,7 +1230,8 @@ static void IsAscii(const FunctionCallbackInfo<Value>& args) {
12301230
env, "Cannot validate on a detached buffer");
12311231
}
12321232

1233-
args.GetReturnValue().Set(simdutf::validate_ascii(abv.data(), abv.length()));
1233+
args.GetReturnValue().Set(
1234+
!simdutf::validate_ascii_with_errors(abv.data(), abv.length()).error);
12341235
}
12351236

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

0 commit comments

Comments
 (0)