Better edge case handling in napi_value<->String conversion (#18107)

This commit is contained in:
190n
2025-03-12 18:15:00 -07:00
committed by GitHub
parent 01db86e915
commit cde668b54c
16 changed files with 253 additions and 81 deletions

View File

@@ -208,7 +208,7 @@ pub const WTFStringImplStruct = extern struct {
return if (input.len > 0) JSC.WebCore.Encoder.byteLengthU8(input.ptr, input.len, .utf8) else 0;
} else {
const input = this.utf16Slice();
return if (input.len > 0) JSC.WebCore.Encoder.byteLengthU16(input.ptr, input.len, .utf8) else 0;
return if (input.len > 0) bun.strings.elementLengthUTF16IntoUTF8([]const u16, input) else 0;
}
}