From 63038098eff653b55dcc011434df4b5f8d39a9e9 Mon Sep 17 00:00:00 2001 From: catscarlet Date: Thu, 30 Sep 2021 16:47:45 +0800 Subject: [PATCH] Updating trim() polyfill. According to mdn: https://github.com/mdn/content/blob/cf607d68522cd35ee7670782d3ee3a361eaef2e4/files/en-us/web/javascript/reference/global_objects/string/trim/index.md --- lib/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/utils.js b/lib/utils.js index 5d966f4448..28b9fea167 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -185,7 +185,7 @@ function isURLSearchParams(val) { * @returns {String} The String freed of excess whitespace */ function trim(str) { - return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, ''); + return str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); } /**