Giter VIP home page Giter VIP logo

Comments (10)

ganeshpatil0101 avatar ganeshpatil0101 commented on May 13, 2024 1

@zivkaziv @ealush I can see other unit tests are failing. does that expected ? I will add unit test for isNegative & isPositive and then raise pr.

from vest.

ganeshpatil0101 avatar ganeshpatil0101 commented on May 13, 2024 1

@ealush @zivkaziv unit tests are working fine. But on my local example of vest with vanilla is not working. I will check it. Thanks.

from vest.

sagivStekolshik avatar sagivStekolshik commented on May 13, 2024

what should happen when:

enforce(0).isNegative() // ❓

or

enforce(0).isPositive() // ❓

from vest.

ealush avatar ealush commented on May 13, 2024

Hey @sagivStekolshik, that's an excellent question.
The truth is that whether zero is positive or negative is context dependent, and sometimes it is regarded as neither.

This means that we can arbitrarily decide how we want to treat it.

For example, we could decide that in both cases it is false

enforce(0).isNegative() // false
enforce(0).isPositive() // false

or even treat it always as true

enforce(0).isNegative() // true
enforce(0).isPositive() // true

In our case, I think it would be most intuitive to start with the negative case:

negative is everything that's smaller than zero value < 0

So anything else would be considered as positive.
In that scenario 0 would be treated as positive.

The one exception is - how to deal with signed zero -0, because:

-0 === 0 // true
Object.is(-0, 0) // false

But since signed zero is so rare in js, it might not even be worth looking at.

from vest.

sagivStekolshik avatar sagivStekolshik commented on May 13, 2024

My idea was using Math.sign() to get the number or string(works as well)
sign function returns 0 or -0 according to MDN
so going the 0 -> false route will be easier
going the 0 isPositive number will be even easier as it can be the "negative" of isNegative

from vest.

ganeshpatil0101 avatar ganeshpatil0101 commented on May 13, 2024

Hi @ealush
I would like to work on this issue.
Please assign to me. I already started working on it and is there any diagram or documentation to get started?
Thanks,

from vest.

zivkaziv avatar zivkaziv commented on May 13, 2024

Is this issue still open?

from vest.

ealush avatar ealush commented on May 13, 2024

@ganeshpatil0101

Hi @ealush
I would like to work on this issue.
Please assign to me. I already started working on it and is there any diagram or documentation to get started?
Thanks,

@zivkaziv

Is this issue still open?

Yes. No need to assign anyone, simply submit a pr and we'll get it merged 🙂

from vest.

ealush avatar ealush commented on May 13, 2024

@ganeshpatil0101 do you have a branch you can share with those changes that do not work? I might be able to help.

from vest.

ganeshpatil0101 avatar ganeshpatil0101 commented on May 13, 2024

@ealush Please review and merge the PR #433
New unit tests are added & all tests are passed.
I request you to test this feature with one real example as I am having issues to setup a vest - vanilla example on local.
Please let me know you if there any changes required.
Thanks.

from vest.

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.