Giter Club home page Giter Club logo

Comments (6)

shaharkazaz avatar shaharkazaz commented on June 8, 2024

@soanvig Well, generally speaking, this is kind of a misuse, but I do agree that this shouldn't result in a stack overflow.
I have some code lying around that should prevent this in TS level by preventing you from passing this kind of configuration, I can add it.
But we still need to support cases where this isn't consumed as part of a TS project so if you want to open a PR for it go ahead ๐Ÿ™‚

from falso.

soanvig avatar soanvig commented on June 8, 2024

@shaharkazaz this is definitely not misuse. Min/max range is inclusive. Therefore min: X, max: X should produce X, because Xโˆˆ<X;X>

from falso.

shaharkazaz avatar shaharkazaz commented on June 8, 2024

@soanvig can you share your use case where you use a random range function where the minimum and maximum are the same and not just use the value itself?

From the use cases I've encountered with Falso I never needed anything like that that's why I'm asking :)

from falso.

soanvig avatar soanvig commented on June 8, 2024

I don't see the reason to give the use case, because that's clearly a bug if there is inconsistency in how Falso works.

I use falso in production code actually. I'm writing a library that generates random data, including numbers.

  1. One case is that I receive min/max range from the libary's user input
  2. Second case is that I simply do some calculations before using falso, and for whatever reason these calculations finish with the result min=max, which is perfectly valid.

I have nothing against falso not working for min=max, but it simply doesn't make sense, and is misleading, because min and max are inclusive ranges (telling from the results produced by Falso). Even if different error is thrown it's still incosistency, and honestly I don't see any reason to not support min=max.

from falso.

shaharkazaz avatar shaharkazaz commented on June 8, 2024

@soanvig

I don't see the reason to give the use case, because that's clearly a bug

It's okay to have a conversation over things, I find the tone of your comment a bit aggressive even though there is no real reason for it. you could have just dropped the intro and written whatever you wrote anyway, I was just interested in your use case. You and I both want to make this OS better.

You are welcome to open a PR to support use cases where the min & max inputs are equal and return this value, make sure you make the change across all functions (if we have any more cases like this)

from falso.

soanvig avatar soanvig commented on June 8, 2024

@shaharkazaz don't worry, I'm never aggressive. After all I answered the question. It's just I feel that the if there is a bug (I think we all agree incosistency is a bug), there is a bug, and talking about use cases dilutes the conversation and diverges from the main topic. Probably if you answered "yeah, that's OK if you open PR", and then asked about use cases out of curiosity, then I wouldn't add that line. That's all :)

I plan to send PR in 2 weeks then.

from falso.

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.