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

Method traverse

packages/graph/src/Steps.ts:3862–3879  ·  view source on GitHub ↗
(
    source: GraphSource<any>,
    input: Iterable<unknown>,
    _context?: QueryContext,
  )

Source from the content-addressed store, hash-verified

3860 }
3861
3862 public *traverse(
3863 source: GraphSource<any>,
3864 input: Iterable<unknown>,
3865 _context?: QueryContext,
3866 ): IterableIterator<unknown> {
3867 const seen = new Set<unknown>();
3868 for (const item of input) {
3869 this.traversed++;
3870 // Handle both TraversalPath and raw values
3871 const value = item instanceof TraversalPath ? item.value : item;
3872 const key = this.#getDeduplicationKey(value);
3873 if (!seen.has(key)) {
3874 seen.add(key);
3875 this.emitted++;
3876 yield item;
3877 }
3878 }
3879 }
3880
3881 /**
3882 * Generate a deduplication key for a value.

Callers

nothing calls this directly

Calls 3

#getDeduplicationKeyMethod · 0.95
addMethod · 0.65
hasMethod · 0.45

Tested by

no test coverage detected