Git Product home page Git Product logo

jmbg's People

Contributors

dedadev avatar dusansimic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

dusansimic

jmbg's Issues

Refactor code

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 ๐Ÿ˜.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.