MCPcopy Create free account
hub / github.com/codemix/graph / intersect

Method intersect

packages/graph/src/Traversals.ts:2151–2164  ·  view source on GitHub ↗

* Intersect the edges in the traversal with another traversal. * @param other The other traversal to intersect with.

(
    other: EdgeTraversal<TSchema, TOtherPath>,
  )

Source from the content-addressed store, hash-verified

2149 * @param other The other traversal to intersect with.
2150 */
2151 public intersect<const TOtherPath extends TraversalPath<any, any, any>>(
2152 other: EdgeTraversal<TSchema, TOtherPath>,
2153 ) {
2154 type TIntersection =
2155 TPath extends TraversalPath<any, infer TValue, any>
2156 ? TOtherPath extends TraversalPath<any, infer TOtherValue, any>
2157 ? TraversalPath<any, TValue & TOtherValue, any>
2158 : never
2159 : TPath & TOtherPath;
2160 return new EdgeTraversal<TSchema, TIntersection>(this.graph, [
2161 ...this.steps,
2162 new IntersectStep({}, other.steps),
2163 ]);
2164 }
2165
2166 /**
2167 * Deduplicate the edges in the traversal.

Callers 6

intersectMethod · 0.45
Traversals.test.tsFile · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected