insertBefore method ✓ 100.0%

Last updated: 2026-03-01T23:35:47.796Z

Metrics

LOC: 10 Complexity: 2 Params: 3 Coverage: 100.0% (5/5 lines, 2x executed)

Signature

insertBefore( beforeName: DetectionMethod, classifier: FieldClassifier, ): : DetectionPipeline

Summary

Returns a new pipeline with a classifier inserted before the one with the given name. Useful for injecting a strategy at a specific priority.

Source Code

  insertBefore(
    beforeName: DetectionMethod,
    classifier: FieldClassifier,
  ): DetectionPipeline {
    const idx = this.classifiers.findIndex((c) => c.name === beforeName);
    if (idx === -1) return this.with(classifier);
    const next = [...this.classifiers];
    next.splice(idx, 0, classifier);
    return new DetectionPipeline(next);
  }

Dependencies (Outgoing)

graph LR insertBefore["insertBefore"] DetectionPipeline["DetectionPipeline"] insertBefore -.->|instantiates| DetectionPipeline style insertBefore fill:#dbeafe,stroke:#2563eb,stroke-width:2px click insertBefore "45f163b7d5d25a47.html" click DetectionPipeline "c51ffbb1759babe9.html"
TargetType
DetectionPipeline instantiates

No incoming dependencies.