max-mapper / max-mapper/callback-hell
Curring and closures
Open
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 858
- Forks
- 101
- PR merge metrics
- No merged PRs in 30d
Description
An example could be:
app.get('something', function (req, res) {
res.render('view1');
});
app.get('other', function (req, res) {
res.render('view1');
});
Refactor to:
function respondWithView (viewName) {
return function ( req, res ) {
res.render(viewName);
};
}
app.get('something', respondWithView('view1'));
app.get('other', respondWithView('view2'));
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No file or test is named. Search the repository's examples or documentation for the shown app.get and res.render snippets, then compare the duplicated handlers with the proposed respondWithView pattern. Done means the matching example uses the closure-based refactoring and preserves the intended rendered views.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- backend
- Issue type
- Refactor
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100