From 7a7e7049c179c87903a0d3a15d323da0ffcc6ed4 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Fri, 15 May 2026 11:56:33 +0200 Subject: [PATCH] Shorten the `isAscii` helper function a tiny bit --- src/core/string_utils.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/core/string_utils.js b/src/core/string_utils.js index 1ef84ec62..4d10e8d3d 100644 --- a/src/core/string_utils.js +++ b/src/core/string_utils.js @@ -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.