export default {
    isValid(bic: string): boolean {
        const bicRegex = /^[A-Z]{6}[A-Z0-9]{2}([A-Z0-9]{3})?$/;

        return bicRegex.test(bic);
    },
};

const BIC_REGEX = /^[A-Z]{6}[A-Z0-9]{2}([A-Z0-9]{3})?$/;

export default {
    isValid(bic: string): boolean {
        return BIC_REGEX.test(bic);
    },
};

Move the regex definition outside of the function
Move the regex definition outside of the function
