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

feat(compose): optimize one function case #1701

Merged
merged 3 commits into from
May 8, 2016
Merged

feat(compose): optimize one function case #1701

merged 3 commits into from
May 8, 2016

Conversation

julien-f
Copy link
Contributor

@julien-f julien-f commented May 7, 2016

No description provided.

@@ -10,11 +10,16 @@
*/

export default function compose(...funcs) {
if (funcs.length === 0) {
const { length } = funcs
if (!length) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd remove this variable extraction. You don't use it below. It's an unnecessary optimization.

@timdorr
Copy link
Member

timdorr commented May 7, 2016

Neat. The branching reads a bit better this way IMHO.

Can you add a test against the new return?

@julien-f
Copy link
Contributor Author

julien-f commented May 8, 2016

Done.

@gaearon gaearon merged commit 050d425 into reduxjs:master May 8, 2016
@@ -12,9 +12,13 @@
export default function compose(...funcs) {
if (funcs.length === 0) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I be using triple = ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep. It's strict equality.

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.

5 participants