mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 11:35:04 +01:00
Add js-docs for linkify function
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
This commit is contained in:
parent
a4d3b5f013
commit
d671bcec31
@ -1,5 +1,13 @@
|
|||||||
import { regex } from "./regex.js";
|
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) {
|
export function linkify(text, callback) {
|
||||||
const matches = text.matchAll(regex);
|
const matches = text.matchAll(regex);
|
||||||
let curr = 0;
|
let curr = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user