e3246cd13b
Inspired by f9b23a5d62
8 lines
277 B
JavaScript
8 lines
277 B
JavaScript
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] : tag;
|
|
}
|
|
);
|
|
}
|