core/converters/finding.converter.ts

core/converters/finding.converter.ts is a file in GovLab Patterns. 6 lines of code and 1 definition.

import type { Finding } from "#types/finding.types";

export const withSupport = function withSupport(findings: readonly (Finding | null)[], support: number): Finding[] {
    return findings
        .filter((finding): finding is Finding => finding !== null)
        .map((finding) => ({ ...finding, support }));
};