mirror of
https://github.com/thelounge/thelounge
synced 2024-12-25 20:03:08 +00:00
17 lines
284 B
JavaScript
17 lines
284 B
JavaScript
"use strict";
|
|
|
|
function findNames(text, users) {
|
|
const result = [];
|
|
let index = 0;
|
|
users.forEach((nick) => {
|
|
index = text.indexOf(nick, index);
|
|
result.push({
|
|
start: index,
|
|
end: index + nick.length,
|
|
nick: nick,
|
|
});
|
|
});
|
|
return result;
|
|
}
|
|
|
|
module.exports = findNames;
|