Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose birth date #44

Merged
merged 3 commits into from
Jan 30, 2022
Merged

Conversation

kbrabrand
Copy link
Contributor

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
Copy link
Owner

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
Copy link
Contributor Author

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
Copy link
Owner

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

@@ -8,45 +51,25 @@
* ```
* @param idNumber norwegian social security number
*/
export const NorwegianId = (idNumber: string) => {
export const NorwegianId = (idNumber: string): NorwegianIdObject => {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK with me, but I couldn't find that the previous type was resolved to any (ref your comment), I got that it resolved to an object:

image

Copy link
Contributor Author

@kbrabrand kbrabrand Jan 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It resolves to an object. But if you try calling the functions on the object the inferred return types of those functions were any (for some reason) 🤷

@mikaello mikaello merged commit 7ff75c0 into mikaello:master Jan 30, 2022
@mikaello
Copy link
Owner

Published to v3.1.0 on NPM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants