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

Method traverse

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

Source from the content-addressed store, hash-verified

2715 }
2716
2717 public *traverse(
2718 _source: GraphSource<any>,
2719 input: Iterable<unknown>,
2720 _context?: QueryContext,
2721 ): IterableIterator<any> {
2722 const { property } = this.config;
2723 let min: any = null;
2724 for (const path of input) {
2725 this.traversed++;
2726 if (path instanceof TraversalPath) {
2727 // If property is specified, get the property value; otherwise use the path value directly
2728 const value = property ? path.property(property as never) : path.value;
2729 if (value !== null && value !== undefined) {
2730 if (min === null) {
2731 min = value;
2732 } else if (typeof value === typeof min) {
2733 // Use < operator for codepoint order (strings) and numeric comparison
2734 if (value < min) {
2735 min = value;
2736 }
2737 }
2738 }
2739 }
2740 }
2741 this.emitted++;
2742 yield min;
2743 }
2744
2745 public override clone(partial?: Partial<AggregateStepConfig>) {
2746 const { config } = this;

Callers

nothing calls this directly

Calls 1

propertyMethod · 0.45

Tested by

no test coverage detected