File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { ValidationOptions } from '../ValidationOptions' ;
22import { buildMessage , ValidateBy } from '../common/ValidateBy' ;
3- import isIBANValidator from 'validator/lib/isIBAN' ;
3+ import isIBANValidator , { IsIBANOptions } from 'validator/lib/isIBAN' ;
44
55export const IS_IBAN = 'isIBAN' ;
66
77/**
88 * Check if a string is a IBAN (International Bank Account Number).
99 * If given value is not a string, then it returns false.
1010 */
11- export function isIBAN ( value : unknown ) : boolean {
12- return typeof value === 'string' && isIBANValidator ( value ) ;
11+ export function isIBAN ( value : unknown , options ?: IsIBANOptions ) : boolean {
12+ return typeof value === 'string' && isIBANValidator ( value , options ) ;
1313}
1414
1515/**
1616 * Check if a string is a IBAN (International Bank Account Number).
1717 * If given value is not a string, then it returns false.
1818 */
19- export function IsIBAN ( validationOptions ?: ValidationOptions ) : PropertyDecorator {
19+ export function IsIBAN ( options ?: IsIBANOptions , validationOptions ?: ValidationOptions ) : PropertyDecorator {
2020 return ValidateBy (
2121 {
2222 name : IS_IBAN ,
2323 validator : {
24- validate : ( value , args ) : boolean => isIBAN ( value ) ,
24+ validate : ( value , args ) : boolean => isIBAN ( value , options ) ,
2525 defaultMessage : buildMessage ( eachPrefix => eachPrefix + '$property must be an IBAN' , validationOptions ) ,
2626 } ,
2727 } ,
You can’t perform that action at this time.
0 commit comments