From 1815c4f00c816c5e3d4ec46c6a08734f5f9674ba Mon Sep 17 00:00:00 2001 From: huangjx Date: Tue, 22 Feb 2022 18:09:35 +0800 Subject: [PATCH] fixed bugs --- src/utils/helper.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/utils/helper.js b/src/utils/helper.js index fc00b92..26d492e 100644 --- a/src/utils/helper.js +++ b/src/utils/helper.js @@ -187,9 +187,12 @@ const helper = { helper.message(msg, 20000); }) }, - str2Boolean: function (string) { - - switch (string.toLowerCase().trim()) { + str2Boolean: function (str) { + if (typeof str != "string") { + return false; + } + + switch (str.toLowerCase().trim()) { case "true": case "yes": case "1": @@ -201,7 +204,7 @@ const helper = { case null: return false; default: - return Boolean(string); + return Boolean(str); } } }