Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import isHSL from './lib/isHSL';

import isISRC from './lib/isISRC';

import isIBAN from './lib/isIBAN';
import isIBAN, { locales as isIBANLocales } from './lib/isIBAN';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be calling them isIBANLocales could be a little misleading, might think it's a validator/function. Perhaps just drop the is?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@profnandaa I see what you're saying, but I think it's more inline with the rest of the code to call it isIBANLocales

import isBIC from './lib/isBIC';

import isMD5 from './lib/isMD5';
Expand Down Expand Up @@ -222,6 +222,7 @@ const validator = {
isDate,
isLicensePlate,
isVAT,
isIBANLocales,
};

export default validator;
2 changes: 2 additions & 0 deletions src/lib/isIBAN.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,5 @@ export default function isIBAN(str) {

return hasValidIbanFormat(str) && hasValidIbanChecksum(str);
}

export const locales = Object.keys(ibanRegexThroughCountryCode);
6 changes: 6 additions & 0 deletions test/exports.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { locales as isAlphaLocales } from '../src/lib/isAlpha';
import { locales as isAlphanumericLocales } from '../src/lib/isAlphanumeric';
import { locales as isMobilePhoneLocales } from '../src/lib/isMobilePhone';
import { locales as isFloatLocales } from '../src/lib/isFloat';
import { locales as ibanCountryCodes } from '../src/lib/isIBAN';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import { locales as ibanCountryCodes } from '../src/lib/isIBAN';
import { locales as isIBANLocales } from '../src/lib/isIBAN';

I would name it isIBANLocales to align to the other one.


describe('Exports', () => {
it('should export validators', () => {
Expand Down Expand Up @@ -50,4 +51,9 @@ describe('Exports', () => {
assert.ok(isFloatLocales instanceof Array);
assert.ok(validator.isFloatLocales instanceof Array);
});

it('should export a list of country codes that implement IBAN', () => {
assert.ok(ibanCountryCodes instanceof Array);
assert.ok(validator.ibanCountryCodes instanceof Array);
});
});