dedadev / jmbg Goto Github PK
View Code? Open in Web Editor NEWJMBG utility tool - npm module
JMBG utility tool - npm module
Hi! First of all, I'd like to say this is a really cool and useful library with rare feature set. To be completely honest, I didn't know all of that data was actually packed inside the JMBG ๐.
Now I have a few ideas on how to refactore the code a bit. I can see there a lot of unnecessary else
statements since return
statements are called. For example here:
37 if(controlNmb !== Number(jmbg.charAt(jmbg.length-1))) return false
38 else {
Also generate()
function has a bit misleading name. Word generate suggests that an input is supplied and an output is generated based on that input. I think that in this context, word random
is more appropriate.
And finally, I think it's better to use throw
statements to emit errors instead of returning a property inside an object. Meaning, decode()
function would return only the data object or throw an error which could be caught using try catch
statement.
I'm happy to open a PR if you're interested in implementing these changes ๐.
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.