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.