style fix, put return up top

This commit is contained in:
Sami Samhuri 2013-10-12 18:36:15 -07:00
parent 9c77cb959e
commit fe05db1595

View file

@ -167,6 +167,11 @@ function handleRequest(req, res) {
} }
function commentServer(context) { function commentServer(context) {
return { get: getComments
, count: countComments
, post: postComment
}
function addComment(post, name, email, url, body, timestamp) { function addComment(post, name, email, url, body, timestamp) {
var comments = context.db.get(post) || [] var comments = context.db.get(post) || []
comments.push({ id: comments.length + 1 comments.push({ id: comments.length + 1
@ -250,11 +255,6 @@ function commentServer(context) {
comments = context.db.get(post) || [] comments = context.db.get(post) || []
res.respond({count: comments.length}) res.respond({count: comments.length})
} }
return { get: getComments
, count: countComments
, post: postComment
}
} }
function requestHandler(context) { function requestHandler(context) {