Refactor
This commit is contained in:
+2
-7
@@ -59,6 +59,7 @@ export async function expandReplyTree(
|
||||
note: Note,
|
||||
cutoff = 5,
|
||||
): Promise<{ last: Note; history: Note[] }> {
|
||||
const last = note;
|
||||
let current = note;
|
||||
let count = 0;
|
||||
const history: Note[] = [];
|
||||
@@ -70,11 +71,5 @@ export async function expandReplyTree(
|
||||
current = parent;
|
||||
count++;
|
||||
}
|
||||
return { last: current, history: history.reverse() };
|
||||
return { last, history: history.reverse() };
|
||||
}
|
||||
|
||||
export const sanitizeText = (text: string) =>
|
||||
text
|
||||
.replaceAll(/(\r\n|\r|\n)\s+/g, "\n\n") // remove extra newlines
|
||||
.replaceAll("@", "@") // remove mentions
|
||||
.replaceAll("#", "#"); // remove hashtags
|
||||
|
||||
Reference in New Issue
Block a user