summaryrefslogtreecommitdiff
path: root/south-african-id-parser.js
diff options
context:
space:
mode:
authorJustin Wernick <justin@worthe-it.co.za>2023-06-06 22:47:19 +0200
committerJustin Wernick <justin@worthe-it.co.za>2023-06-06 22:47:19 +0200
commite0b1e3df773c8b60d523a8feac6f7242e0f70d88 (patch)
tree16b07d22ace5be04b7fc486b57b395bc643e72f2 /south-african-id-parser.js
parent51620869473bb8dcbe5ce7c0bae8bf5442d2120a (diff)
Remove unnecessary braces
Diffstat (limited to 'south-african-id-parser.js')
-rw-r--r--south-african-id-parser.js10
1 files changed, 5 insertions, 5 deletions
diff --git a/south-african-id-parser.js b/south-african-id-parser.js
index 81b2302..8e233e7 100644
--- a/south-african-id-parser.js
+++ b/south-african-id-parser.js
@@ -8,7 +8,7 @@
} else {
global.saIdParser = factory();
}
-}(this, (function () {
+}(this, function () {
'use strict';
return {
@@ -92,7 +92,7 @@
return undefined;
}
- //get year, and assume century
+ // get year, and assume century
var currentYear = new Date().getFullYear();
var currentCentury = Math.floor(currentYear/100)*100;
var yearPart = currentCentury + parseInt(idNumber.substring(0,2), 10);
@@ -100,14 +100,14 @@
yearPart -= 100; //must be last century
}
- //In Javascript, Jan=0. In ID Numbers, Jan=1.
+ // In Javascript, Jan=0. In ID Numbers, Jan=1.
var monthPart = parseInt(idNumber.substring(2,4), 10)-1;
var dayPart = parseInt(idNumber.substring(4,6), 10);
var dateOfBirth = new Date(yearPart, monthPart, dayPart);
- //validate that date is in a valid range by making sure that it wasn't 'corrected' during construction
+ // validate that date is in a valid range by making sure that it wasn't 'corrected' during construction
if (!dateOfBirth || dateOfBirth.getFullYear() !== yearPart || dateOfBirth.getMonth() !== monthPart || dateOfBirth.getDate() !== dayPart) {
return undefined;
}
@@ -132,4 +132,4 @@
}
return parseInt(idNumber[10], 10) === 0;
}
-})));
+}));