Skip to content
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

Add a note about boolean flags #7

Open
daedalus28 opened this issue Nov 7, 2019 · 0 comments
Open

Add a note about boolean flags #7

daedalus28 opened this issue Nov 7, 2019 · 0 comments
Assignees

Comments

@daedalus28
Copy link
Contributor

We should a note like this:

In general, we prefer designing APIs such that boolean flags are opt in - so true changes the behavior. APIs that set boolean values to default to true are confusing in JS because it means that true and "missing" (or undefined) behave the same and only false is different.

We should generally strive to ensure that for boolean flags, omitting a flag and explicitly marking it as false behave the same way. Sometimes this means you just invert the name - for example, contexture-client has disableAutoUpdate as a flag which you can opt in to instead of autoUpdate which would have to default to true (and thereby make undefined and true behave the same)

Opened as an issue first in case anyone has any points to bring up

@daedalus28 daedalus28 self-assigned this Nov 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant