Curring and closures
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 35/100
- Issue 类型
- 重构
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- javascript
- 领域
- backend
调研方向
未指定文件或测试。请在仓库的示例或文档中搜索所示的 app.get 和 res.render 代码片段,然后将重复的处理器与提议的 respondWithView 模式进行比较。当匹配的示例使用基于闭包的重构并保留预期渲染的视图时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
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'));
- 主要语言
- JavaScript
- 星标
- 855
- 派生
- 101
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
max-mapper/callback-hell 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 55/100
max-mapper/callback-hell#41 ·
-
难度 1/5 1 小时以内 新手友好度 45/100
max-mapper/callback-hell#36 · 2 条评论 ·
-
License未关闭
难度 3/5 1-2 天 新手友好度 25/100
max-mapper/callback-hell#35 · 1 条评论 ·
-
难度 1/5 1 小时以内 新手友好度 35/100
max-mapper/callback-hell#33 · 3 条评论 ·
-
async未关闭
难度 3/5 1-2 天 新手友好度 35/100
max-mapper/callback-hell#32 · 1 条评论 · 7 个 reaction ·
查看 max-mapper/callback-hell 的全部 Issue
相似的 Issue
-
check:failed feeds:add
难度 2/5 1-3 小时 新手友好度 65/100
iptv-org/database#38938 · 2 条评论 ·
维护者通常 4 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 66/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
rescript-lang/rescript#9182 ·
维护者通常 1 天内回复
-
Analysis
难度 2/5 1-3 小时 新手友好度 72/100
SACGF/variantgrid#2615 ·
维护者通常 1 天内回复
-
curriculum documentation quality
难度 2/5 1-3 小时 新手友好度 72/100
githubnext/gh-aw-workshop#5297 ·
维护者通常 1 天内回复