-
Notifications
You must be signed in to change notification settings - Fork 7
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
Conversation
… for calling it out of object context
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 😊 |
…to avoid `any` types
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 |
Thanks for updating the readme, and I agree with you with the |
@@ -8,45 +51,25 @@ | |||
* ``` | |||
* @param idNumber norwegian social security number | |||
*/ | |||
export const NorwegianId = (idNumber: string) => { | |||
export const NorwegianId = (idNumber: string): NorwegianIdObject => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
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) 🤷
Published to v3.1.0 on NPM. |
This PR adds
birthDate
as a function on the object API and alls exposes thepossibleBirthDateOfIdNumber
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.