s/var/let/
This commit is contained in:
@@ -4,12 +4,12 @@ function linkifyChannel(text, transformChannel) {
|
||||
// Don't match punctuation at the end of the channel name
|
||||
const channelRegex = /(?:^|\s)(#[^\s]+[^\s.?!…():;,])/gid;
|
||||
|
||||
var children = [];
|
||||
var match;
|
||||
var last = 0;
|
||||
let children = [];
|
||||
let match;
|
||||
let last = 0;
|
||||
while ((match = channelRegex.exec(text)) !== null) {
|
||||
var channel = match[1];
|
||||
var [start, end] = match.indices[1];
|
||||
let channel = match[1];
|
||||
let [start, end] = match.indices[1];
|
||||
|
||||
children.push(text.substring(last, start));
|
||||
children.push(transformChannel(channel));
|
||||
@@ -34,20 +34,20 @@ export default function linkify(text, onChannelClick) {
|
||||
>${channel}</a>`;
|
||||
}
|
||||
|
||||
var links = anchorme.list(text);
|
||||
let links = anchorme.list(text);
|
||||
|
||||
var children = [];
|
||||
var last = 0;
|
||||
let children = [];
|
||||
let last = 0;
|
||||
links.forEach((match) => {
|
||||
const prefix = text.substring(last, match.start)
|
||||
children.push(...linkifyChannel(prefix, transformChannel));
|
||||
|
||||
var proto = match.protocol || "https://";
|
||||
let proto = match.protocol || "https://";
|
||||
if (match.isEmail) {
|
||||
proto = "mailto:";
|
||||
}
|
||||
|
||||
var url = match.string;
|
||||
let url = match.string;
|
||||
if (!url.startsWith(proto)) {
|
||||
url = proto + url;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user