fix: fix an error when the validLowerCase and validUpperCase function have no params

This commit is contained in:
Aisen60 2020-09-18 13:14:50 +08:00
parent 3e4fbb1b0c
commit 47244302ff
1 changed files with 2 additions and 0 deletions

View File

@ -33,6 +33,7 @@ export function validURL(url) {
* @returns {Boolean}
*/
export function validLowerCase(str) {
// https://www.coder.work/article/1041931
if (str === undefined || str === null) return false
const reg = /^[a-z]+$/
return reg.test(str)
@ -43,6 +44,7 @@ export function validLowerCase(str) {
* @returns {Boolean}
*/
export function validUpperCase(str) {
// https://www.coder.work/article/1041931
if (str === undefined || str === null) return false
const reg = /^[A-Z]+$/
return reg.test(str)