Use startsWith and endsWith for readability
This commit is contained in:
parent
bf7875bfaa
commit
08a59591ae
7 changed files with 8 additions and 8 deletions
|
|
@ -13,7 +13,7 @@ export type TextElementLink = {
|
|||
export default function(text: string) {
|
||||
const match = text.match(/^\??\[([^\[\]]+?)\]\((https?:\/\/[\w\/:%#@\$&\?!\(\)\[\]~\.=\+\-]+?)\)/);
|
||||
if (!match) return null;
|
||||
const silent = text[0] == '?';
|
||||
const silent = text.startsWith('?');
|
||||
const link = match[0];
|
||||
const title = match[1];
|
||||
const url = match[2];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue