From 5208fda7d6e2930d47723acb3b14211497fab118 Mon Sep 17 00:00:00 2001 From: Liia Alice Menke Date: Tue, 17 Jun 2025 17:48:23 +0200 Subject: [PATCH] feat(IsIBAN): Add IsIBANOptions as argument for IsIBAN decorator --- src/decorator/string/IsIBAN.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/decorator/string/IsIBAN.ts b/src/decorator/string/IsIBAN.ts index d0a159fc83..d10c39653b 100644 --- a/src/decorator/string/IsIBAN.ts +++ b/src/decorator/string/IsIBAN.ts @@ -1,6 +1,6 @@ import { ValidationOptions } from '../ValidationOptions'; import { buildMessage, ValidateBy } from '../common/ValidateBy'; -import isIBANValidator from 'validator/lib/isIBAN'; +import isIBANValidator, { IsIBANOptions } from 'validator/lib/isIBAN'; export const IS_IBAN = 'isIBAN'; @@ -8,20 +8,20 @@ export const IS_IBAN = 'isIBAN'; * Check if a string is a IBAN (International Bank Account Number). * If given value is not a string, then it returns false. */ -export function isIBAN(value: unknown): boolean { - return typeof value === 'string' && isIBANValidator(value); +export function isIBAN(value: unknown, options?: IsIBANOptions): boolean { + return typeof value === 'string' && isIBANValidator(value, options); } /** * Check if a string is a IBAN (International Bank Account Number). * If given value is not a string, then it returns false. */ -export function IsIBAN(validationOptions?: ValidationOptions): PropertyDecorator { +export function IsIBAN(options?: IsIBANOptions, validationOptions?: ValidationOptions): PropertyDecorator { return ValidateBy( { name: IS_IBAN, validator: { - validate: (value, args): boolean => isIBAN(value), + validate: (value, args): boolean => isIBAN(value, options), defaultMessage: buildMessage(eachPrefix => eachPrefix + '$property must be an IBAN', validationOptions), }, },