thelounge/client/js/libs/handlebars/ircmessageparser/findNames.js

18 lines
284 B
JavaScript
Raw Normal View History

2017-11-14 23:36:45 +01:00
"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;