( mutable: MutableGraph<N, E, T>, f: (data: E) => E )
| 1899 | * @since 3.18.0 |
| 1900 | */ |
| 1901 | export const mapEdges = <N, E, T extends Kind = "directed">( |
| 1902 | mutable: MutableGraph<N, E, T>, |
| 1903 | f: (data: E) => E |
| 1904 | ): void => { |
| 1905 | assertMutable(mutable) |
| 1906 | const impl = graphImpl(mutable) |
| 1907 | |
| 1908 | // Transform existing edge data in place |
| 1909 | for (const [index, edgeData] of impl.edges) { |
| 1910 | const newData = f(edgeData.data) |
| 1911 | impl.edges.set( |
| 1912 | index, |
| 1913 | new Edge({ |
| 1914 | ...edgeData, |
| 1915 | data: newData |
| 1916 | }) |
| 1917 | ) |
| 1918 | } |
| 1919 | } |
| 1920 | |
| 1921 | /** |
| 1922 | * @internal |
nothing calls this directly
no test coverage detected