Skip to content

Commit

Permalink
str style
Browse files Browse the repository at this point in the history
  • Loading branch information
Gonals committed Jun 24, 2024
1 parent fb53a80 commit 6b12681
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/str.ts
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ const Str = {
* @returns True if the string is a domain name
*/
isValidDomainName(str: string): boolean {
return Boolean(String(str).match(Constants.CONST.REG_EXP.DOMAIN));
return !!String(str).match(Constants.CONST.REG_EXP.DOMAIN);
},

/**
Expand All @@ -359,7 +359,7 @@ const Str = {
* @returns True if the string is a valid hyperlink
*/
isValidURL(str: string): boolean {
return Boolean(String(str).match(Constants.CONST.REG_EXP.HYPERLINK));
return !!String(str).match(Constants.CONST.REG_EXP.HYPERLINK);
},

/**
Expand All @@ -371,7 +371,7 @@ const Str = {
* @returns True if the string is an email
*/
isValidEmail(str: string): boolean {

Check failure on line 373 in lib/str.ts

View workflow job for this annotation

GitHub Actions / lint

A function whose declared type is neither 'undefined', 'void', nor 'any' must return a value.
return Boolean(String(str).match(Constants.CONST.REG_EXP.EMAIL));
!!String(str).match(Constants.CONST.REG_EXP.EMAIL);

Check failure on line 374 in lib/str.ts

View workflow job for this annotation

GitHub Actions / lint

Expected an assignment or function call and instead saw an expression
},

/**
Expand All @@ -382,7 +382,7 @@ const Str = {
* @returns True if the string is an valid email created by comment markdown.
*/
isValidEmailMarkdown(str: string): boolean {
return Boolean(String(str).match(`^${Constants.CONST.REG_EXP.MARKDOWN_EMAIL}$`));
return !!String(str).match(`^${Constants.CONST.REG_EXP.MARKDOWN_EMAIL}$`);
},

/**
Expand Down Expand Up @@ -818,7 +818,7 @@ const Str = {
if (this.isString(value)) {
return value.toLowerCase() === 'true';
}
return Boolean(value);
return !!value;
},

/**
Expand Down

0 comments on commit 6b12681

Please sign in to comment.