Shorten the isAscii helper function a tiny bit

This commit is contained in:
Jonas Jenwald 2026-05-15 11:56:33 +02:00
parent 153cef615e
commit 7a7e7049c1

View File

@ -16,10 +16,7 @@
import { Util } from "../shared/util.js";
function isAscii(str) {
if (typeof str !== "string") {
return false;
}
return !str || /^[\x00-\x7F]*$/.test(str);
return typeof str === "string" && (!str || /^[\x00-\x7F]*$/.test(str));
}
// If the string is null or undefined then it is returned as is.