mikaello / norwegian-national-id-validator

Validate Norwegian national identity numbers
https://mikaello.github.io/norwegian-national-id-validator
MIT License
24 stars 7 forks source link

Expose birth date #44

Closed kbrabrand closed 2 years ago

kbrabrand commented 2 years ago

This PR adds birthDate as a function on the object API and alls exposes the possibleBirthDateOfIdNumber function that was not exported before.

Having a way of getting the birthDate for an ID number would be handy, and would mean that we could stop doing chekcs for id types, subtract 4 from the 3rd digit of D-numbers etc.

mikaello commented 2 years ago

Cool, thanks for this contribution!

Could you update the README with this new functionality as well (both object oriented API and functional)?

With updated doc I'll be happy to merge this 😊

kbrabrand commented 2 years ago

Added missing info to the readme now, and made a small change to the mildly confusing examples on the main readme with if statements and a following line with the "output". Now showing a console log which is more in line with what you'd do to get the results shown.

Also typed the object API return type to give proper return types for the functions in the object returned (was any for the functions called through the object API).

mikaello commented 2 years ago

Thanks for updating the readme, and I agree with you with the ifs, they were a bit confusing, hehe!

mikaello commented 2 years ago

Published to v3.1.0 on NPM.