MCPcopy Create free account
hub / github.com/Effect-TS/effect / mapEdges

Function mapEdges

packages/effect/src/Graph.ts:1901–1919  ·  view source on GitHub ↗
(
  mutable: MutableGraph<N, E, T>,
  f: (data: E) => E
)

Source from the content-addressed store, hash-verified

1899 * @since 3.18.0
1900 */
1901export 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

Callers

nothing calls this directly

Calls 4

assertMutableFunction · 0.85
graphImplFunction · 0.85
setMethod · 0.65
fFunction · 0.50

Tested by

no test coverage detected