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)
| Target | Type |
|---|---|
| DetectionPipeline | instantiates |
No incoming dependencies.