Skip to content

Commit

Permalink
Validation should ignore spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
David Koblas committed Dec 10, 2018
1 parent 078c0cc commit 945966b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ibankit",
"version": "1.1.5",
"version": "1.1.6",
"description": "Validation, field extraction and creation of IBAN, BBAN, BIC numbers",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion src/iban.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export class IBAN {
*/
static isValid(iban: string): boolean {
try {
ibanUtil.validate(iban);
ibanUtil.validate(iban.replace(/[ \t-]/g, ""));
} catch {
return false;
}
Expand Down
4 changes: 3 additions & 1 deletion test/iban.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ describe("IBAN", () => {
it("valid iban", () => {
expect(IBAN.isValid("BA391990440001200279")).toBe(true);
});

it("valid with spaces", () => {
expect(IBAN.isValid("DE89 3704 0044 0532 0130 00")).toBe(true);
});
it("bad iban", () => {
expect(IBAN.isValid("BA391990440001200278")).toBe(false);
});
Expand Down

0 comments on commit 945966b

Please sign in to comment.