{"action":"created","comment":{"url":"https://api.github.com/repos/badges/shields/pulls/comments/24461635","id":24461635,"diff_hunk":"@@ -765,12 +766,44 @@ cache(function(data, match, sendBadge, request) {\n     }\n     try {\n       var data = JSON.parse(buffer);\n-      // Grab the latest stable version, or an unstable\n+\n       var versions = Object.keys(data.package.versions);\n-      var version = latestVersion(versions);\n-      var vdata = versionColor(version);\n-      badgeData.text[1] = vdata.version;\n-      badgeData.colorscheme = vdata.color;\n+      var stableVersion = latestVersion(versions);\n+      var vdata = versionColor(stableVersion);\n+\n+      var badgeText = null;\n+      var badgeColor = null;\n+\n+      switch (info) {\n+          case 'v':\n+              badgeText = vdata.version;\n+              badgeColor = vdata.color;\n+              break;\n+          case 'vpre':\n+              if (versions[0] !== undefined) {","path":"server.js","position":null,"original_position":38,"commit_id":"96458a00a0c43ae687db09704023c8e26de777d4","original_commit_id":"129de83477a76fbd32ba6ae50b4a5de5e9b1286e","user":{"login":"WouterDS","id":1210628,"avatar_url":"https://avatars.githubusercontent.com/u/1210628?v=3","gravatar_id":"","url":"https://api.github.com/users/WouterDS","html_url":"https://github.com/WouterDS","followers_url":"https://api.github.com/users/WouterDS/followers","following_url":"https://api.github.com/users/WouterDS/following{/other_user}","gists_url":"https://api.github.com/users/WouterDS/gists{/gist_id}","starred_url":"https://api.github.com/users/WouterDS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WouterDS/subscriptions","organizations_url":"https://api.github.com/users/WouterDS/orgs","repos_url":"https://api.github.com/users/WouterDS/repos","events_url":"https://api.github.com/users/WouterDS/events{/privacy}","received_events_url":"https://api.github.com/users/WouterDS/received_events","type":"User","site_admin":false},"body":"Well, I suppose line 771 - 772 can be moved inside of the vpre case if that's what you mean?\r\n\r\nL783 is just a habbit, checking if it exists, but might be cleaner to change that to if (versions) or if (versions.length > 0).","created_at":"2015-02-10T23:28:41Z","updated_at":"2015-02-10T23:28:41Z","html_url":"https://github.com/badges/shields/pull/366#discussion_r24461635","pull_request_url":"https://api.github.com/repos/badges/shields/pulls/366","_links":{"self":{"href":"https://api.github.com/repos/badges/shields/pulls/comments/24461635"},"html":{"href":"https://github.com/badges/shields/pull/366#discussion_r24461635"},"pull_request":{"href":"https://api.github.com/repos/badges/shields/pulls/366"}}},"pull_request":{"url":"https://api.github.com/repos/badges/shields/pulls/366","id":28964196,"html_url":"https://github.com/badges/shields/pull/366","diff_url":"https://github.com/badges/shields/pull/366.diff","patch_url":"https://github.com/badges/shields/pull/366.patch","issue_url":"https://api.github.com/repos/badges/shields/issues/366","number":366,"state":"open","locked":false,"title":"Packagist vpre support.","user":{"login":"WouterDS","id":1210628,"avatar_url":"https://avatars.githubusercontent.com/u/1210628?v=3","gravatar_id":"","url":"https://api.github.com/users/WouterDS","html_url":"https://github.com/WouterDS","followers_url":"https://api.github.com/users/WouterDS/followers","following_url":"https://api.github.com/users/WouterDS/following{/other_user}","gists_url":"https://api.github.com/users/WouterDS/gists{/gist_id}","starred_url":"https://api.github.com/users/WouterDS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WouterDS/subscriptions","organizations_url":"https://api.github.com/users/WouterDS/orgs","repos_url":"https://api.github.com/users/WouterDS/repos","events_url":"https://api.github.com/users/WouterDS/events{/privacy}","received_events_url":"https://api.github.com/users/WouterDS/received_events","type":"User","site_admin":false},"body":"This commit adds support for packagist vpre. #319\r\n\r\nFor example:\r\n\r\n- stable symfony/symfony: ![stable symfony framework](http://cl.ly/ZhQF/direct), latest dev: ![latest dev symfony framework](http://cl.ly/Zhr3/direct)\r\n- stable laravel/framework: ![stable laravel framework](http://cl.ly/ZheA/direct), latest dev: ![latest laravel framework](http://cl.ly/Zhcu/direct)","created_at":"2015-02-09T22:47:02Z","updated_at":"2015-02-10T23:28:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d1bfce4d92498f3c80cdd875f287e681f5185e6b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/badges/shields/pulls/366/commits","review_comments_url":"https://api.github.com/repos/badges/shields/pulls/366/comments","review_comment_url":"https://api.github.com/repos/badges/shields/pulls/comments/{number}","comments_url":"https://api.github.com/repos/badges/shields/issues/366/comments","statuses_url":"https://api.github.com/repos/badges/shields/statuses/96458a00a0c43ae687db09704023c8e26de777d4","head":{"label":"WouterDS:master","ref":"master","sha":"96458a00a0c43ae687db09704023c8e26de777d4","user":{"login":"WouterDS","id":1210628,"avatar_url":"https://avatars.githubusercontent.com/u/1210628?v=3","gravatar_id":"","url":"https://api.github.com/users/WouterDS","html_url":"https://github.com/WouterDS","followers_url":"https://api.github.com/users/WouterDS/followers","following_url":"https://api.github.com/users/WouterDS/following{/other_user}","gists_url":"https://api.github.com/users/WouterDS/gists{/gist_id}","starred_url":"https://api.github.com/users/WouterDS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WouterDS/subscriptions","organizations_url":"https://api.github.com/users/WouterDS/orgs","repos_url":"https://api.github.com/users/WouterDS/repos","events_url":"https://api.github.com/users/WouterDS/events{/privacy}","received_events_url":"https://api.github.com/users/WouterDS/received_events","type":"User","site_admin":false},"repo":{"id":30558115,"name":"shields","full_name":"WouterDS/shields","owner":{"login":"WouterDS","id":1210628,"avatar_url":"https://avatars.githubusercontent.com/u/1210628?v=3","gravatar_id":"","url":"https://api.github.com/users/WouterDS","html_url":"https://github.com/WouterDS","followers_url":"https://api.github.com/users/WouterDS/followers","following_url":"https://api.github.com/users/WouterDS/following{/other_user}","gists_url":"https://api.github.com/users/WouterDS/gists{/gist_id}","starred_url":"https://api.github.com/users/WouterDS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WouterDS/subscriptions","organizations_url":"https://api.github.com/users/WouterDS/orgs","repos_url":"https://api.github.com/users/WouterDS/repos","events_url":"https://api.github.com/users/WouterDS/events{/privacy}","received_events_url":"https://api.github.com/users/WouterDS/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/WouterDS/shields","description":"Shields badge specification, website and default API server","fork":true,"url":"https://api.github.com/repos/WouterDS/shields","forks_url":"https://api.github.com/repos/WouterDS/shields/forks","keys_url":"https://api.github.com/repos/WouterDS/shields/keys{/key_id}","collaborators_url":"https://api.github.com/repos/WouterDS/shields/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/WouterDS/shields/teams","hooks_url":"https://api.github.com/repos/WouterDS/shields/hooks","issue_events_url":"https://api.github.com/repos/WouterDS/shields/issues/events{/number}","events_url":"https://api.github.com/repos/WouterDS/shields/events","assignees_url":"https://api.github.com/repos/WouterDS/shields/assignees{/user}","branches_url":"https://api.github.com/repos/WouterDS/shields/branches{/branch}","tags_url":"https://api.github.com/repos/WouterDS/shields/tags","blobs_url":"https://api.github.com/repos/WouterDS/shields/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/WouterDS/shields/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/WouterDS/shields/git/refs{/sha}","trees_url":"https://api.github.com/repos/WouterDS/shields/git/trees{/sha}","statuses_url":"https://api.github.com/repos/WouterDS/shields/statuses/{sha}","languages_url":"https://api.github.com/repos/WouterDS/shields/languages","stargazers_url":"https://api.github.com/repos/WouterDS/shields/stargazers","contributors_url":"https://api.github.com/repos/WouterDS/shields/contributors","subscribers_url":"https://api.github.com/repos/WouterDS/shields/subscribers","subscription_url":"https://api.github.com/repos/WouterDS/shields/subscription","commits_url":"https://api.github.com/repos/WouterDS/shields/commits{/sha}","git_commits_url":"https://api.github.com/repos/WouterDS/shields/git/commits{/sha}","comments_url":"https://api.github.com/repos/WouterDS/shields/comments{/number}","issue_comment_url":"https://api.github.com/repos/WouterDS/shields/issues/comments/{number}","contents_url":"https://api.github.com/repos/WouterDS/shields/contents/{+path}","compare_url":"https://api.github.com/repos/WouterDS/shields/compare/{base}...{head}","merges_url":"https://api.github.com/repos/WouterDS/shields/merges","archive_url":"https://api.github.com/repos/WouterDS/shields/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/WouterDS/shields/downloads","issues_url":"https://api.github.com/repos/WouterDS/shields/issues{/number}","pulls_url":"https://api.github.com/repos/WouterDS/shields/pulls{/number}","milestones_url":"https://api.github.com/repos/WouterDS/shields/milestones{/number}","notifications_url":"https://api.github.com/repos/WouterDS/shields/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/WouterDS/shields/labels{/name}","releases_url":"https://api.github.com/repos/WouterDS/shields/releases{/id}","created_at":"2015-02-09T20:57:52Z","updated_at":"2015-02-10T23:24:38Z","pushed_at":"2015-02-10T23:24:38Z","git_url":"git://github.com/WouterDS/shields.git","ssh_url":"git@github.com:WouterDS/shields.git","clone_url":"https://github.com/WouterDS/shields.git","svn_url":"https://github.com/WouterDS/shields","homepage":"http://shields.io","size":5528,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"badges:master","ref":"master","sha":"321c725949cf58f04fd6b0de5d30af9ce5a6a9b0","user":{"login":"badges","id":6254238,"avatar_url":"https://avatars.githubusercontent.com/u/6254238?v=3","gravatar_id":"","url":"https://api.github.com/users/badges","html_url":"https://github.com/badges","followers_url":"https://api.github.com/users/badges/followers","following_url":"https://api.github.com/users/badges/following{/other_user}","gists_url":"https://api.github.com/users/badges/gists{/gist_id}","starred_url":"https://api.github.com/users/badges/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/badges/subscriptions","organizations_url":"https://api.github.com/users/badges/orgs","repos_url":"https://api.github.com/users/badges/repos","events_url":"https://api.github.com/users/badges/events{/privacy}","received_events_url":"https://api.github.com/users/badges/received_events","type":"Organization","site_admin":false},"repo":{"id":7910045,"name":"shields","full_name":"badges/shields","owner":{"login":"badges","id":6254238,"avatar_url":"https://avatars.githubusercontent.com/u/6254238?v=3","gravatar_id":"","url":"https://api.github.com/users/badges","html_url":"https://github.com/badges","followers_url":"https://api.github.com/users/badges/followers","following_url":"https://api.github.com/users/badges/following{/other_user}","gists_url":"https://api.github.com/users/badges/gists{/gist_id}","starred_url":"https://api.github.com/users/badges/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/badges/subscriptions","organizations_url":"https://api.github.com/users/badges/orgs","repos_url":"https://api.github.com/users/badges/repos","events_url":"https://api.github.com/users/badges/events{/privacy}","received_events_url":"https://api.github.com/users/badges/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/badges/shields","description":"Shields badge specification, website and default API server","fork":false,"url":"https://api.github.com/repos/badges/shields","forks_url":"https://api.github.com/repos/badges/shields/forks","keys_url":"https://api.github.com/repos/badges/shields/keys{/key_id}","collaborators_url":"https://api.github.com/repos/badges/shields/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/badges/shields/teams","hooks_url":"https://api.github.com/repos/badges/shields/hooks","issue_events_url":"https://api.github.com/repos/badges/shields/issues/events{/number}","events_url":"https://api.github.com/repos/badges/shields/events","assignees_url":"https://api.github.com/repos/badges/shields/assignees{/user}","branches_url":"https://api.github.com/repos/badges/shields/branches{/branch}","tags_url":"https://api.github.com/repos/badges/shields/tags","blobs_url":"https://api.github.com/repos/badges/shields/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/badges/shields/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/badges/shields/git/refs{/sha}","trees_url":"https://api.github.com/repos/badges/shields/git/trees{/sha}","statuses_url":"https://api.github.com/repos/badges/shields/statuses/{sha}","languages_url":"https://api.github.com/repos/badges/shields/languages","stargazers_url":"https://api.github.com/repos/badges/shields/stargazers","contributors_url":"https://api.github.com/repos/badges/shields/contributors","subscribers_url":"https://api.github.com/repos/badges/shields/subscribers","subscription_url":"https://api.github.com/repos/badges/shields/subscription","commits_url":"https://api.github.com/repos/badges/shields/commits{/sha}","git_commits_url":"https://api.github.com/repos/badges/shields/git/commits{/sha}","comments_url":"https://api.github.com/repos/badges/shields/comments{/number}","issue_comment_url":"https://api.github.com/repos/badges/shields/issues/comments/{number}","contents_url":"https://api.github.com/repos/badges/shields/contents/{+path}","compare_url":"https://api.github.com/repos/badges/shields/compare/{base}...{head}","merges_url":"https://api.github.com/repos/badges/shields/merges","archive_url":"https://api.github.com/repos/badges/shields/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/badges/shields/downloads","issues_url":"https://api.github.com/repos/badges/shields/issues{/number}","pulls_url":"https://api.github.com/repos/badges/shields/pulls{/number}","milestones_url":"https://api.github.com/repos/badges/shields/milestones{/number}","notifications_url":"https://api.github.com/repos/badges/shields/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/badges/shields/labels{/name}","releases_url":"https://api.github.com/repos/badges/shields/releases{/id}","created_at":"2013-01-30T07:41:54Z","updated_at":"2015-02-10T22:24:00Z","pushed_at":"2015-02-10T22:24:00Z","git_url":"git://github.com/badges/shields.git","ssh_url":"git@github.com:badges/shields.git","clone_url":"https://github.com/badges/shields.git","svn_url":"https://github.com/badges/shields","homepage":"http://shields.io","size":5528,"stargazers_count":1295,"watchers_count":1295,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":161,"mirror_url":null,"open_issues_count":64,"forks":161,"open_issues":64,"watchers":1295,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/badges/shields/pulls/366"},"html":{"href":"https://github.com/badges/shields/pull/366"},"issue":{"href":"https://api.github.com/repos/badges/shields/issues/366"},"comments":{"href":"https://api.github.com/repos/badges/shields/issues/366/comments"},"review_comments":{"href":"https://api.github.com/repos/badges/shields/pulls/366/comments"},"review_comment":{"href":"https://api.github.com/repos/badges/shields/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/badges/shields/pulls/366/commits"},"statuses":{"href":"https://api.github.com/repos/badges/shields/statuses/96458a00a0c43ae687db09704023c8e26de777d4"}}}}