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

Function mapNodes

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

Source from the content-addressed store, hash-verified

1862 * @since 3.18.0
1863 */
1864export const mapNodes = <N, E, T extends Kind = "directed">(
1865 mutable: MutableGraph<N, E, T>,
1866 f: (data: N) => N
1867): void => {
1868 assertMutable(mutable)
1869 const impl = graphImpl(mutable)
1870
1871 // Transform existing node data in place
1872 for (const [index, data] of impl.nodes) {
1873 const newData = f(data)
1874 impl.nodes.set(index, newData)
1875 }
1876}
1877
1878/**
1879 * Transforms all edge data in a mutable graph using the provided mapping function.

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