summaryrefslogtreecommitdiff
path: root/south-african-id-parser.d.ts
diff options
context:
space:
mode:
authorJustin Wernick <justin@worthe-it.co.za>2023-08-04 21:57:35 +0200
committerJustin Wernick <justin@worthe-it.co.za>2023-08-07 10:41:44 +0200
commita0d4c3c3447e07ba66ce4d8882d051eafe2d4d28 (patch)
tree8fac49344785d4b90cd293c0c1f4585fdf5a01f3 /south-african-id-parser.d.ts
parent6a158dd03c24fb7d7e66b7b93a4906702020ca22 (diff)
Add typescript types to the package
This doesn't change any internal workings, but makes this package easier to use by anyone using Typescript. Fix #12
Diffstat (limited to 'south-african-id-parser.d.ts')
-rw-r--r--south-african-id-parser.d.ts34
1 files changed, 34 insertions, 0 deletions
diff --git a/south-african-id-parser.d.ts b/south-african-id-parser.d.ts
new file mode 100644
index 0000000..b401e7b
--- /dev/null
+++ b/south-african-id-parser.d.ts
@@ -0,0 +1,34 @@
+export function parse(idNumber: string): {
+ /**
+ * - true
+ */
+ isValid: boolean;
+ /**
+ * - The date of birth from the ID number.
+ */
+ dateOfBirth: Date;
+ /**
+ * - The sex from the ID number - true if male, false if female.
+ */
+ isMale: boolean;
+ /**
+ * - The sex from the ID number - true if female, false if male.
+ */
+ isFemale: boolean;
+ /**
+ * - Citizenship status from the ID
+ * number, true if it indicates South African citizenship.
+ */
+ isSouthAfricanCitizen: boolean;
+} | {
+ /**
+ * - false
+ */
+ isValid: boolean;
+};
+export function validate(idNumber: string): boolean;
+export function parseDateOfBirth(idNumber: string): Date;
+export function parseIsMale(idNumber: string): boolean;
+export function parseIsFemale(idNumber: string): boolean;
+export function parseIsSouthAfricanCitizen(idNumber: string): boolean;
+//# sourceMappingURL=south-african-id-parser.d.ts.map \ No newline at end of file