Functional Weave
Code in TypeScript

validation.iban@1.0.0

vectors.json

2,525 bytes · view raw

[
  { "name": "the published ISO 13616 example for the United Kingdom", "args": ["GB82 WEST 1234 5698 7654 32"], "expect": true },
  { "name": "the same IBAN unspaced and in lower case", "args": ["gb82west12345698765432"], "expect": true },
  { "name": "the published German example", "args": ["DE89 3704 0044 0532 0130 00"], "expect": true },
  { "name": "a French IBAN, whose BBAN contains letters", "args": ["FR14 2004 1010 0505 0001 3M02 606"], "expect": true },
  { "name": "Malta, one of the longest registered lengths at 31", "args": ["MT84 MALT 0110 0001 2345 MTLC AST0 01S"], "expect": true },
  { "name": "Norway, the shortest registered length at 15", "args": ["NO93 8601 1117 947"], "expect": true },
  { "name": "Russia, 33 characters, well past a 64-bit integer once expanded", "args": ["RU02 0445 2560 0407 0281 0412 3456 7890 1"], "expect": true },
  { "name": "Saint Lucia, 32 characters and letter-heavy", "args": ["LC55 HEMM 0001 0001 0012 0012 0002 3015"], "expect": true },
  { "name": "a Spanish IBAN", "args": ["ES91 2100 0418 4502 0005 1332"], "expect": true },
  { "name": "a Swiss IBAN", "args": ["CH93 0076 2011 6238 5295 7"], "expect": true },
  { "name": "a Belgian IBAN, the shortest in the euro area at 16", "args": ["BE68 5390 0754 7034"], "expect": true },
  { "name": "a second UK IBAN, so the table is not pinned by one bank", "args": ["GB29 NWBK 6016 1331 9268 19"], "expect": true },
  { "name": "the empty string is not an IBAN", "args": [""], "expect": false },
  { "name": "right shape and length, check digits off by one", "args": ["GB82 WEST 1234 5698 7654 33"], "expect": false },
  { "name": "two digits of the account number transposed", "args": ["GB82 WEST 1234 5698 7645 32"], "expect": false },
  { "name": "one character short for the United Kingdom", "args": ["GB82WEST1234569876543"], "expect": false },
  { "name": "a country code that is not in the IBAN registry", "args": ["ZZ82WEST12345698765432"], "expect": false },
  { "name": "the check digits are letters", "args": ["GBXX WEST 1234 5698 7654 32"], "expect": false },
  { "name": "hyphens are not an accepted separator", "args": ["GB82-WEST-1234-5698-7654-32"], "expect": false },
  { "name": "the United States has no IBAN, whatever the length", "args": ["US64SVBKUS6S3300958879"], "expect": false },
  { "name": "a lower case country code alone is not enough to fail", "args": ["Gb82 west 1234 5698 7654 32"], "expect": true },
  { "name": "a non-string argument is not an IBAN", "args": [82], "expect": false }
]