kelszo / personnummer.js Goto Github PK
View Code? Open in Web Editor NEWJavascript script to validate Swedish personal identity numbers
License: MIT License
Javascript script to validate Swedish personal identity numbers
License: MIT License
The 2.2.0 version includes breaking changes compared to 2.1.0 which is unexpected if it's supposed to adhere to semantic versioning.
As an example, look at the normalise
function. In 2.1.0 it returns an empty string if passed invalid input. In 2.2.0 it returns undefined
. This means that consuming code that assumes the returned value will always be a string will now suddenly break if the input has not been validated before calling the function.
The changelog does not mention this change at all. It does mention other changes that sound breaking, like changing default options.
When a library does not follow semantic versioning it complicates things for consumers who want to keep their dependencies up to date. It is much easier if library authors try to be strict about breaking changes - then non-major version bumps can mostly be merged right away.
It seems like you are using an arrow function in one place in the code.
In the getBirthplace function: personalNumber/parse.js@156
I tried to replace it with a normal function and then your code works in IE11. I would be nice if you could fix that or maybe run it through babel before publish it on npm?
Thank you!
The documentation states that:
normaliseCIN(str) | Normalises the input to the following format. E.g. 168025216220 -> 802521-6220
But it's the other way around, i.e.
802521-6220 -> 168025216220
According to the documentation, normaliseCIN()
or personnummer.parseCIN()
will add the digits "16" to a normalised version of an aktiebolag CIN. For example "556007-3495" will become "165560073495".
Is that a standard of some sorts?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.