From 55b7c55efe5cf3bbf4b7889842ca304bc6064570 Mon Sep 17 00:00:00 2001 From: RMidhunSuresh Date: Wed, 12 May 2021 15:52:05 +0530 Subject: [PATCH] Pull callback args into variables Signed-off-by: RMidhunSuresh --- src/domain/session/room/timeline/linkify/linkify.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/domain/session/room/timeline/linkify/linkify.js b/src/domain/session/room/timeline/linkify/linkify.js index 6ebf4e9f..632918e6 100644 --- a/src/domain/session/room/timeline/linkify/linkify.js +++ b/src/domain/session/room/timeline/linkify/linkify.js @@ -4,12 +4,14 @@ export function linkify(text, callback) { const matches = text.matchAll(regex); let curr = 0; for (let match of matches) { - callback(text.slice(curr, match.index), false); + const precedingText = text.slice(curr, match.index); + callback(precedingText, false); callback(match[0], true); const len = match[0].length; curr = match.index + len; } - callback(text.slice(curr), false); + const remainingText = text.slice(curr); + callback(remainingText, false); } export function tests() {