Giter VIP home page Giter VIP logo

Comments (3)

shssoichiro avatar shssoichiro commented on June 9, 2024 1

This would be a good case for optional parameters in Rust. 🙂 But since those don't exist, I don't think there's a clear, objective benefit to changing the function.

from zxcvbn-rs.

shssoichiro avatar shssoichiro commented on June 9, 2024

I'm not sure that I agree that this would be cleaner. I feel that having one exported function makes the interface and its options obvious straight away, and makes it easy to switch between having user inputs or not (by having an empty slice).

from zxcvbn-rs.

ThomasdenH avatar ThomasdenH commented on June 9, 2024

I can see your reasoning as well. My thinking was, what would a user that didn't know the library well expect the following statement to do:

let password_quality = zxcvbn("password", &[]);

I would expect the first parameter to be the password to be tested, and be right. However, I wouldn't know the meaning of the second parameter without looking at the documentation. This means I'd have to read up on it to understand the code even if I didn't use the parameter myself. Separating the functions mitigates this, and it has the additional advantage of conveying the meaning of the second parameter if I do want to use it.

Anyway, it's not a big thing, so if you disagree I'm fine with closing the issue.

from zxcvbn-rs.

Related Issues (20)

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.