{"action":"opened","issue":{"url":"https://api.github.com/repos/quirkey/sammy/issues/254","repository_url":"https://api.github.com/repos/quirkey/sammy","labels_url":"https://api.github.com/repos/quirkey/sammy/issues/254/labels{/name}","comments_url":"https://api.github.com/repos/quirkey/sammy/issues/254/comments","events_url":"https://api.github.com/repos/quirkey/sammy/issues/254/events","html_url":"https://github.com/quirkey/sammy/issues/254","id":157129146,"number":254,"title":"runRoute function (dead code)","user":{"login":"aplicacionamedida","id":9158583,"avatar_url":"https://avatars.githubusercontent.com/u/9158583?v=3","gravatar_id":"","url":"https://api.github.com/users/aplicacionamedida","html_url":"https://github.com/aplicacionamedida","followers_url":"https://api.github.com/users/aplicacionamedida/followers","following_url":"https://api.github.com/users/aplicacionamedida/following{/other_user}","gists_url":"https://api.github.com/users/aplicacionamedida/gists{/gist_id}","starred_url":"https://api.github.com/users/aplicacionamedida/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aplicacionamedida/subscriptions","organizations_url":"https://api.github.com/users/aplicacionamedida/orgs","repos_url":"https://api.github.com/users/aplicacionamedida/repos","events_url":"https://api.github.com/users/aplicacionamedida/events{/privacy}","received_events_url":"https://api.github.com/users/aplicacionamedida/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-05-27T04:45:31Z","updated_at":"2016-05-27T04:45:31Z","closed_at":null,"body":"I observed some dead code in the funciton runRoute():\r\n```\r\n          if (typeof(route.callback) === \"function\") {\r\n            route.callback = [route.callback];\r\n          }\r\n          if (route.callback && route.callback.length) {\r\n            i = -1;\r\n            nextRoute = function() {\r\n              i++;\r\n              if (route.callback[i]) {\r\n                returned = route.callback[i].apply(context,callback_args);\r\n              } else if (app._onComplete && typeof(app._onComplete === \"function\")) {\r\n                app._onComplete(context);\r\n              }\r\n            };\r\n            callback_args.push(nextRoute);\r\n            nextRoute();\r\n          }\r\n```\r\n\r\nVariable \"i\" has no meaning, because a chain of callback is not well implemented.\r\n\r\nFor this reason, I think that this code should be deleted also:\r\n```         \r\n        if (typeof(route.callback) === \"function\") {\r\n            route.callback = [route.callback];\r\n          }\r\n```\r\n\r\nCallback should be always a function. Never an array.\r\n\r\nFor this reason this code , also has to be  changed:\r\n```\r\n    if (route.callback[i]) {\r\n```"}}
{"actor":{"display_login":"aplicacionamedida"}}