New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Boolean State #8
Comments
@cowboyd for |
You've pointed to an important use-case new Bool(false).set("Ohai").valueOf() //=> true It will be coerced in the sense that all values passed to const Bool = State.extend({
construct(value) {
return !!value;
}
}); |
you mean, I tried to implement Bool but it doesn't seem to call the constructor function yet. Is there something missing from implementation to do this yet? |
Yes, it has not been added yet, so you will have to coerce the value manually for now. We could call it |
|
The microstate primitive
Bool
wraps a simple boolean value.No matter what you pass to the constructor, it is naturally coerced into a boolean value:
The same applies if you set a boolean value to explicit value:
The only other transition available on a boolean value is
toggle
:The text was updated successfully, but these errors were encountered: