Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 59x 59x 59x 59x 4x 2x 2x 2x 10x 2x 59x | import { createSelector } from "@ngrx/store" import { hierarchy } from "d3-hierarchy" import { CodeMapNode } from "../../../codeCharta.model" import { AccumulatedData, accumulatedDataSelector } from "./accumulatedData.selector" export const _calculateIdToNode = (accumulatedData: Pick<AccumulatedData, "unifiedMapNode">): Map<number, CodeMapNode> => { if (!accumulatedData.unifiedMapNode) { return new Map() } const idToNode: Map<number, CodeMapNode> = new Map([[accumulatedData.unifiedMapNode.id, accumulatedData.unifiedMapNode]]) for (const { data } of hierarchy(accumulatedData.unifiedMapNode)) { idToNode.set(data.id, data) } return idToNode } export const idToNodeSelector = createSelector(accumulatedDataSelector, _calculateIdToNode) |