Skip to content

Commit 45332fc

Browse files
author
Dmitry Ovsyanko
committed
BankCard, SNILS -raise
1 parent f66ca9d commit 45332fc

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

lib/BankCard.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ module.exports = class extends Luhn {
1515

1616
for (const pos of [4, 9, 14])
1717
if (str.charCodeAt (pos) !== CH_SPACE)
18-
this.raise ('Wrong format', {code: 'format', pos})
18+
return ['Wrong format', {code: 'format', pos}]
1919

20-
super.verify (str.slice (0, 4) + str.slice (5, 9) + str.slice (10, 14) + str.slice (15))
20+
return super.verify (str.slice (0, 4) + str.slice (5, 9) + str.slice (10, 14) + str.slice (15))
2121

2222
}
2323

lib/SNILS.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ module.exports = class extends ScalarProduct {
1818

1919
for (const [pos, code] of [[3, CH_HYPHEN], [7, CH_HYPHEN], [11, CH_SPACE]])
2020
if (str.charCodeAt (pos) !== code)
21-
this.raise ('Wrong format', {code: 'format', pos})
21+
return ['Wrong format', {code: 'format', pos}]
2222

23-
super.verify (str.slice (0, 3) + str.slice (4, 7) + str.slice (8, 11) + str.slice (12))
23+
return super.verify (str.slice (0, 3) + str.slice (4, 7) + str.slice (8, 11) + str.slice (12))
2424

2525
}
2626

0 commit comments

Comments
 (0)