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

correct function arg order #49

Open
graingert opened this issue Jun 2, 2017 · 0 comments
Open

correct function arg order #49

graingert opened this issue Jun 2, 2017 · 0 comments

Comments

@graingert
Copy link
Collaborator

graingert commented Jun 2, 2017

When simple static analysis can trivially work out that the argument order is obviously wrong:

// good
_.map(x => x.y, vals);

// bad
_.map(vals, x => x.y);

// bad
_.map([a, b, c], eg);

// ok - unnecessary wrap should catch it though.
function foo(vals, f) {
  return _.map(vals, f);
}

// ok - undefined var should catch it.
_.map(vals, ff);

// ok - nothing you can do about this, you're 'pwnd'.
const fff = getFn();
_.map(vals, fff);

// bad
function ffff(x) {
  return x.y;
}

_.map(vals, ffff);
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