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

Inconsistent syntax for exporting functions #45

Closed
Sequoia opened this issue Mar 25, 2014 · 4 comments · Fixed by #47
Closed

Inconsistent syntax for exporting functions #45

Sequoia opened this issue Mar 25, 2014 · 4 comments · Fixed by #47

Comments

@Sequoia
Copy link
Contributor

Sequoia commented Mar 25, 2014

Some do this:

function repeat(operation, num) {
  // SOLUTION GOES HERE
}
module.exports = repeat

Some do this:

module.exports = function(input) {
  // SOLUTION GOES HERE
}

Some do this:

module.exports = function getShortMessages(messages) {
  // SOLUTION GOES HERE
}

There's not a functional issue here, and maybe these are intentionally written to expose the learner to multiple syntaxes for CommonJS exports, but I think this could trip up & confuse a beginner: "Why are there three ways to do this? Which one's better?" etc..

In my opinion either:
a) an explanation of modules/exports & their syntax should be included early on (probably via a lesson) or
b) these should all be standardized to one syntax, so the learner can focus on the lesson at hand and not "why is this boilerplate different from the last lesson"

I'm happy to fix these up and create a PR if such a change is welcome - just let me know. 👍

@timoxley
Copy link
Owner

@Sequoia thanks for the feedback! I think this is valid, I'd accept a PR for the first style if you wanted to submit it 👍

@Sequoia
Copy link
Contributor Author

Sequoia commented Mar 25, 2014

Will do this week, thanks for quick follow up!

@Sequoia
Copy link
Contributor Author

Sequoia commented Mar 26, 2014

Waiting for #43 to land or get rejected to do this one. (In that PR, I rename all the files in question in this issue).

@timoxley
Copy link
Owner

@Sequoia done

Sequoia added a commit to Sequoia/functional-javascript-workshop that referenced this issue Mar 28, 2014
also problem.md markdown cleanup
closes timoxley#45
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 a pull request may close this issue.

2 participants