core/predicates/link.predicate.ts

core/predicates/link.predicate.ts is a file in Bane's Lab Site. 11 lines of code and 2 definitions.

import { GENERIC_LINK_TEXT } from "#configuration/constants/link.constants";
import { SPACE } from "#configuration/constants/document.constants";

const collapseText = function collapseText(text: string): string {
    return text
        .split(SPACE)
        .filter((word) => word.length > 0)
        .join(SPACE);
};

export const isGenericLabel = function isGenericLabel(text: string): boolean {
    return GENERIC_LINK_TEXT.has(collapseText(text).toLowerCase());
};