buildClassifiersFromSettings function presentation exported ✓ 100.0%

Last updated: 2026-03-04T23:21:38.391Z

Metrics

LOC: 14 Complexity: 3 Params: 2 Coverage: 100.0% (6/6 lines, 7x executed)

Signature

buildClassifiersFromSettings( config: Array<{ name: string; enabled: boolean }>, ): : FieldClassifier[]

Summary

Builds a classifier list from a user-defined ordered config. Strategies not listed or disabled are excluded. html-fallback is always appended last when not already present.

Source Code

export function buildClassifiersFromSettings(
  config: Array<{ name: string; enabled: boolean }>,
): FieldClassifier[] {
  const ordered = config
    .filter((s) => s.enabled && NAMED_CLASSIFIERS[s.name])
    .map((s) => NAMED_CLASSIFIERS[s.name]);

  // Ensure there's always a fallback terminator
  if (!ordered.find((c) => c.name === "html-fallback")) {
    ordered.push(htmlFallbackClassifier);
  }

  return ordered;
}

No outgoing dependencies.

Impact (Incoming)

graph LR buildClassifiersFromSettings["buildClassifiersFromSettings"] FillableElement["FillableElement"] classifierNames["classifierNames"] FillableElement -->|uses| buildClassifiersFromSettings classifierNames -->|uses| buildClassifiersFromSettings style buildClassifiersFromSettings fill:#dbeafe,stroke:#2563eb,stroke-width:2px click buildClassifiersFromSettings "46427ea521375797.html" click FillableElement "2ecf5aaac3f668a8.html" click classifierNames "a00f1b67db4c0c6d.html"
SourceType
FillableElement uses
classifierNames uses