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

reverse empty argument check in constructors #1887

Merged

Conversation

marianoguerra
Copy link
Contributor

The most common way to call a constructor to make an empty collection is to call it without arguments, then value is undefined.

With this commit the first check to see if the value passed to the constructor is not set is for undefined, the most common way to call it.

This way the condition will only have to evaluate the left side for the common case.

The most common way to call a constructor to make an empty collection is
to call it without arguments, then value is undefined.

With this commit the first check to see if the value passed to the
constructor is not set is for undefined, the most common way to call
it.

This way the condition will only have to evaluate the left side for the
common case.
@jdeniau jdeniau merged commit 803e8a9 into immutable-js:main Oct 28, 2021
@jdeniau
Copy link
Member

jdeniau commented Oct 28, 2021

Thanks @marianoguerra !

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.

None yet

2 participants