perf(core): replace Array.forEach loops

This commit is contained in:
braks
2024-02-05 07:51:12 +01:00
committed by Braks
parent 66d7198a2f
commit c4b4a04aa0
9 changed files with 57 additions and 42 deletions
@@ -20,15 +20,21 @@ const markers = computed(() => {
} else {
markers.push({ id: markerId, color: defaultColor, type: marker as MarkerType })
}
ids.push(markerId)
}
}
}
;[connectionLineOptions.markerEnd, connectionLineOptions.markerStart].forEach(createMarkers)
for (const marker of [connectionLineOptions.markerEnd, connectionLineOptions.markerStart]) {
createMarkers(marker)
}
edges.reduce<MarkerProps[]>((markers, edge) => {
;[edge.markerStart, edge.markerEnd].forEach(createMarkers)
for (const marker of [edge.markerStart, edge.markerEnd]) {
createMarkers(marker)
}
return markers.sort((a, b) => a.id.localeCompare(b.id))
}, markers)