Render quoted mentions as text

This commit is contained in:
Josh Perez 2020-09-18 17:43:57 -04:00 committed by Josh Perez
parent bc3b61db1d
commit 2d5292b2f3
7 changed files with 26 additions and 32 deletions

View file

@ -0,0 +1,12 @@
import { BodyRangesType } from '../types/Util';
export function getTextWithMentions(
bodyRanges: BodyRangesType,
text: string
): string {
return bodyRanges.reduce((str, range) => {
const textBegin = str.substr(0, range.start);
const textEnd = str.substr(range.start + range.length, str.length);
return `${textBegin}@${range.replacementText}${textEnd}`;
}, text);
}