blob: 9b663487fe4c74cacfd2c57c874ee53652755fda (
plain) (
blame)
1
2
3
4
5
6
7
8
|
export function recoverHashtags (recognizedTags, text) {
return recognizedTags.map(tag => {
const re = new RegExp(`(?:^|[^\/\)\w])#(${tag.name})`, 'i');
const matched_hashtag = text.match(re);
return matched_hashtag ? matched_hashtag[1] : null;
}
).filter(x => x !== null);
}
|