Closed simenandre closed 4 years ago
Thanks for your inputs and ideas!
I like the idea of this more object oriented API. I think both the old approach and this could fit in the same library. The object oriented API could be just a wrapper for calling external functions, e.g.
const IdValidator = (ssn, properties) => ({
ssn,
properties,
isValid: () => validateNorwegianIdNumber(ssn),
isMale: () => (getSsnGender(ssn) === Gender.Male),
...
})
This way all the functionality is available both as a functional and object oriented API.
Cool that you want to collaborate! And I agree that there may be enough Norwegian SSN validators that do about the same thing, just with tiny modifications of the API :-)
Regarding name and versioning/forking, I have to reflect a bit more about my stand.
Nice idea! That way it doesn't need to be a new major version, so maybe that is the better way. We would only be adding features, the only negative thing would be the upkeep of having multiple endpoints, but the package is simple enough that it wouldn't be a problem.
Hello đź‘‹
Thank you for an awesome package! I've had some time using this package for a few projects, and have some ideas to further improve it.
Hyperoslo has a Swift-based package to validate and extract information from a Norwegian SSN. I really like their API-design – maybe that is something we can do for this package as well?
Some examples, that maybe could work:
Obviously, this would be a breaking change to the library, but it will serve the same purpose so I think there are good reasons to not depreciate and renew. However, the NPM package name
no-ssn
, andnor-ssn
is available, so that could point to forking and release under a new name maybe? Btw, I know there are packages out there who have multiple validators ("all batteries included"). I like Sindre Sorhus's idea of keeping NPM packages small, and I think it's much better to have this staying a dedicated package for validating SSN. However, I don't wanna go solo and birth a yet another package for this. I would rather collaborate and make something better together.Other points, the part «extract information» would in my opinion generally be something new to this package. However, the idea of it makes me wanna do a more generic name scheme.
I say we because I really would like to collaborate on this. So, let me know your thoughts on it! :) Thanks again for a great package!