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

Method traverse

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

Source from the content-addressed store, hash-verified

2758 }
2759
2760 public *traverse(
2761 _source: GraphSource<any>,
2762 input: Iterable<unknown>,
2763 _context?: QueryContext,
2764 ): IterableIterator<any> {
2765 const { property } = this.config;
2766 let max: any = null;
2767 for (const path of input) {
2768 this.traversed++;
2769 if (path instanceof TraversalPath) {
2770 // If property is specified, get the property value; otherwise use the path value directly
2771 const value = property ? path.property(property as never) : path.value;
2772 if (value !== null && value !== undefined) {
2773 if (max === null) {
2774 max = value;
2775 } else if (typeof value === typeof max) {
2776 // Use > operator for codepoint order (strings) and numeric comparison
2777 if (value > max) {
2778 max = value;
2779 }
2780 }
2781 }
2782 }
2783 }
2784 this.emitted++;
2785 yield max;
2786 }
2787
2788 public override clone(partial?: Partial<AggregateStepConfig>) {
2789 const { config } = this;

Callers

nothing calls this directly

Calls 1

propertyMethod · 0.45

Tested by

no test coverage detected