Skip to content

Instantly share code, notes, and snippets.

@nackjicholson
Last active August 29, 2015 14:12
Show Gist options
  • Save nackjicholson/5738997a4483f3ec1315 to your computer and use it in GitHub Desktop.
Save nackjicholson/5738997a4483f3ec1315 to your computer and use it in GitHub Desktop.
Dispute.

A stylistic dispute about indentation and line breaking of large function calls which take a callback as well.

This? All parentheses and brackets on separate lines, arguments indented and given their own line breaks to start on.

async.waterfall(
  [
    func1,
    func2,
    funcN
  ],
  function(error, data) {
    // code
  }
);

OR

Less indentation, brackets sharing lines, ending square bracket to argument 1 on the same line as callback declaration.

async.waterfall([
  func1,
  func2,
  funcN
], function(error, data) {
  // code
});

Which looks more natural? Which is more consistent with community aesthetics?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment