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

fix: replace ternary operator with nullish #1447

Closed
wants to merge 1 commit into from

Conversation

jaymagrob
Copy link

Note: the socket.io.js file is the generated output of make socket.io.js, and should not be manually modified.

The kind of change this PR does introduce

  • a bug fix
  • a new feature
  • an update to the documentation
  • a code change that improves performance
  • other

Current behaviour

When the user has the opt randomizationFactor set to 0, the ternary operator changes that to 0.5 as 0 is a falsey value. In the documentation is says a user can select 0 to 1.

New behaviour

Using the nullish coalescing means undefined and null will still get set to 0.5 but 0 will stay at 0.

Other information (e.g. related issues)

According to MDN, this is not available in Internet Explorer so might need a new solution for compatibility.

@darrachequesne
Copy link
Member

Merged as dfb46b5. Thanks!

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

Successfully merging this pull request may close these issues.

3 participants