Validator.js: isIBAN requires a string.

Created on 4 Mar 2021  路  1Comment  路  Source: validatorjs/validator.js

Describe the bug
isIBAN requires a string.

Examples
I'm using Vuelidate to validate form fields. I'm creating helper functions where I extend the isIBAN validator from ValidatorJS:

export const isIBANValidation = (value) => {
  return value ? isIBAN(value) : false
}

Without the ternary statement I receive this error:

TypeError: Expected a string but received a null
    at assertString (assertString.js?d887:17)
    at isIBAN (isIBAN.js?38f4:143)

Other validators like isDate don't have this issue.

Additional context

    "validator": "^13.5.2",
    "vuelidate": "0.7.6"
馃悰 bug

Most helpful comment

I think it's working as expected. Your code where it's not working may have passed value as null, while your ternary operator checks if value is null before passing it to isIBAN

>All comments

I think it's working as expected. Your code where it's not working may have passed value as null, while your ternary operator checks if value is null before passing it to isIBAN

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jaxkodex picture jaxkodex  路  3Comments

karladler picture karladler  路  3Comments

MindRapist picture MindRapist  路  4Comments

rathboma picture rathboma  路  4Comments

AtomicBorg picture AtomicBorg  路  3Comments