diff --git a/src/domain/session/room/timeline/linkify/linkify.js b/src/domain/session/room/timeline/linkify/linkify.js index 333705c1..58641055 100644 --- a/src/domain/session/room/timeline/linkify/linkify.js +++ b/src/domain/session/room/timeline/linkify/linkify.js @@ -1,5 +1,13 @@ import { regex } from "./regex.js"; +/** + * Splits text into links and non-links. + * For each such separated token, callback is called + * with the token and a boolean passed as argument. + * The boolean indicates whether the token is a link or not. + * @param {string} text Text to split + * @param {function(string, boolean)} callback A function to call with split tokens + */ export function linkify(text, callback) { const matches = text.matchAll(regex); let curr = 0;