mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-20 18:25:21 -04:00
fix(frontend): improve performance by reducing array constructions
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
28f04f461c
commit
ced4cd953c
6 changed files with 26 additions and 24 deletions
|
@ -42,7 +42,8 @@ const processCommentNode = (node: DataNode): void => {
|
|||
return
|
||||
}
|
||||
|
||||
for (const dataAttribute of [...regexResult[2].matchAll(dataAttributesSyntax)]) {
|
||||
const matches = [...regexResult[2].matchAll(dataAttributesSyntax)]
|
||||
for (const dataAttribute of matches) {
|
||||
const attributeName = dataAttribute[1]
|
||||
const attributeValue = dataAttribute[2] ?? dataAttribute[3]
|
||||
if (attributeValue) {
|
||||
|
|
|
@ -63,10 +63,7 @@ export class LineContentToLineIdMapper {
|
|||
LineContentToLineIdMapper.changeIsNotChangingLines(change) ||
|
||||
LineContentToLineIdMapper.changeIsAddingLines(change)
|
||||
)
|
||||
.reduce(
|
||||
(previousLineKeys, currentChange) => [...previousLineKeys, ...this.convertChangeToLinesWithIds(currentChange)],
|
||||
[] as LineWithId[]
|
||||
)
|
||||
.flatMap((currentChange) => this.convertChangeToLinesWithIds(currentChange))
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue