Skip to main content
Iranian Sheba codes follow the ISO 13616 IBAN standard: the literal IR followed by 24 digits (2-digit check + 3-digit bank code + 19-digit account part). Persian Tools provides validation via isShebaValid and rich info lookup via getShebaInfo.

Functions

isShebaValid(shebaCode)

Returns boolean. Uses the ISO 7064 mod-97 check with chunked arithmetic (no BigInt, browser-safe).

getShebaInfo(shebaCode)

Returns rich bank info — or null if the Sheba is invalid or the bank code isn’t in the table.
For banks where the library knows how to extract the account number, the result is ShebaResultWithAccountNumber (accountNumberAvailable: true). Otherwise it’s ShebaResultWithoutAccountNumber (accountNumberAvailable: false).

Types

The accountNumberAvailable flag is a discriminant — narrow the union with it:

Exported regexes

Pitfalls

  • The validator is isShebaValid, not verifySheba. No verifySheba function exists.
  • The bank’s Persian name is persianName, not bankName. There is no bankName field.
  • No automatic whitespace handling. Strip spaces in the caller: code.replace(/\s/g, "").toUpperCase().
  • No automatic Persian/Arabic digit normalization. Run autoConvertDigitsToEN upstream if input may contain them.

Source

src/modules/sheba/index.ts, src/modules/sheba/helpers.ts (chunked mod-97), src/modules/sheba/codes.skip.ts (bank table) · Tests: test/sheba.spec.ts