All checks were successful
Build and Push Docker Images / build-backend (push) Successful in 44s
Build and Push Docker Images / build-frontend (push) Successful in 22s
Build and Push Docker Images / build-website (push) Successful in 21s
Build and Push Docker Images / build-central-services-api (push) Successful in 22s
Build and Push Docker Images / build-central-services-admin (push) Successful in 23s
Build and Push Docker Images / build-docs (push) Successful in 21s
23 lines
715 B
TypeScript
23 lines
715 B
TypeScript
export type BankingInstitution = {
|
|
bic?: unknown
|
|
[key: string]: unknown
|
|
}
|
|
|
|
export const findBankInstitutionByBic = (
|
|
institutions: unknown,
|
|
bic: string,
|
|
): BankingInstitution | null => {
|
|
if (!Array.isArray(institutions)) return null
|
|
|
|
const normalizedBic = bic.trim().toUpperCase()
|
|
if (!normalizedBic) return null
|
|
|
|
const institution = institutions.find((candidate): candidate is BankingInstitution => {
|
|
if (!candidate || typeof candidate !== "object") return false
|
|
const candidateBic = (candidate as BankingInstitution).bic
|
|
return typeof candidateBic === "string" && candidateBic.trim().toUpperCase() === normalizedBic
|
|
})
|
|
|
|
return institution || null
|
|
}
|