Skip to content

Commit b1c13ed

Browse files
authored
validation: add checksum validation of Swedish organization numbers (#38)
1 parent 256af7e commit b1c13ed

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

.changeset/tall-symbols-enjoy.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@obosbbl/validation": patch
3+
---
4+
5+
add checksum validation of Swedish organization numbers. Previously we only checked the length of the number.

packages/validation/src/se.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export function validateOrganizationNumber(
8181
value = stripFormatting(value);
8282
}
8383

84-
return /^\d{10}$/.test(value);
84+
return /^\d{10}$/.test(value) && mod10(value);
8585
}
8686

8787
type NationalIdentityNumberFormat = 'short' | 'long';

0 commit comments

Comments
 (0)