{"action":"created","issue":{"url":"https://api.github.com/repos/heroku/semver.io/issues/51","labels_url":"https://api.github.com/repos/heroku/semver.io/issues/51/labels{/name}","comments_url":"https://api.github.com/repos/heroku/semver.io/issues/51/comments","events_url":"https://api.github.com/repos/heroku/semver.io/issues/51/events","html_url":"https://github.com/heroku/semver.io/issues/51","id":114592502,"number":51,"title":"Provide optional list of versions to match against","user":{"login":"jasonkarns","id":119972,"avatar_url":"https://avatars.githubusercontent.com/u/119972?v=3","gravatar_id":"","url":"https://api.github.com/users/jasonkarns","html_url":"https://github.com/jasonkarns","followers_url":"https://api.github.com/users/jasonkarns/followers","following_url":"https://api.github.com/users/jasonkarns/following{/other_user}","gists_url":"https://api.github.com/users/jasonkarns/gists{/gist_id}","starred_url":"https://api.github.com/users/jasonkarns/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasonkarns/subscriptions","organizations_url":"https://api.github.com/users/jasonkarns/orgs","repos_url":"https://api.github.com/users/jasonkarns/repos","events_url":"https://api.github.com/users/jasonkarns/events{/privacy}","received_events_url":"https://api.github.com/users/jasonkarns/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-11-02T13:22:25Z","updated_at":"2015-11-06T17:31:29Z","closed_at":null,"body":"This is a great tool and is quite helpful for the nodenv ecosystem. @hurrymaplelad built a [plugin for nodenv](https://github.com/hurrymaplelad/nodenv-package-json-engine) that lets nodenv pull its version from package.json `engines` instead of `.node-version`. It is using this service to determine the best node version that satisfies the version spec from `engines`. However, that's only half the puzzle for nodenv. In addition to simply finding the maximum version match for a given semver range, we would like to take into account versions that are installed.\r\n\r\nI would love to see the ability to pass a semver range and also a list of versions, and have semver.io select the best option available from the provided list (defaulting to current behavior if none match).\r\n\r\nSince this would be an optional extra parameter (array), then omitting it does not alter current behavior.\r\n\r\nExample:\r\n\r\n```\r\nhttps://semver.io/node/resolve?range=>%3D4.0.0\r\n5.0.0\r\n\r\nhttps://semver.io/node/resolve?range=>%3D4.0.0&v=4.2.1\r\n4.2.1\r\n\r\nhttps://semver.io/node/resolve?range=>%3D4.0.0&v=4.0.0&v=4.1.0&v=4.2.1\r\n4.2.1\r\n\r\nhttps://semver.io/node/resolve?range=>%3D4.0.0&v=0.10.0&v=0.12.0\r\n5.0.0\r\n```\r\n\r\nThoughts?"},"comment":{"url":"https://api.github.com/repos/heroku/semver.io/issues/comments/154479826","html_url":"https://github.com/heroku/semver.io/issues/51#issuecomment-154479826","issue_url":"https://api.github.com/repos/heroku/semver.io/issues/51","id":154479826,"user":{"login":"hurrymaplelad","id":1083040,"avatar_url":"https://avatars.githubusercontent.com/u/1083040?v=3","gravatar_id":"","url":"https://api.github.com/users/hurrymaplelad","html_url":"https://github.com/hurrymaplelad","followers_url":"https://api.github.com/users/hurrymaplelad/followers","following_url":"https://api.github.com/users/hurrymaplelad/following{/other_user}","gists_url":"https://api.github.com/users/hurrymaplelad/gists{/gist_id}","starred_url":"https://api.github.com/users/hurrymaplelad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hurrymaplelad/subscriptions","organizations_url":"https://api.github.com/users/hurrymaplelad/orgs","repos_url":"https://api.github.com/users/hurrymaplelad/repos","events_url":"https://api.github.com/users/hurrymaplelad/events{/privacy}","received_events_url":"https://api.github.com/users/hurrymaplelad/received_events","type":"User","site_admin":false},"created_at":"2015-11-06T17:31:29Z","updated_at":"2015-11-06T17:31:29Z","body":"Cool idea Jason! I wonder if we can compare installed versions against a semver expression locally to avoid the network dependency for the common case?  I bet there's a nose module that does this. Haven't looked yet\n\n> On Nov 2, 2015, at 5:22 AM, Jason Karns <notifications@github.com> wrote:\n> \n> This is a great tool and is quite helpful for the nodenv ecosystem. @hurrymaplelad built a plugin for nodenv that lets nodenv pull its version from package.json engines instead of .node-version. It is using this service to determine the best node version that satisfies the version spec from engines. However, that's only half the puzzle for nodenv. In addition to simply finding the maximum version match for a given semver range, we would like to take into account versions that are installed.\n> \n> I would love to see the ability to pass a semver range and also a list of versions, and have semver.io select the best option available from the provided list (defaulting to current behavior if none match).\n> \n> Since this would be an optional extra parameter (array), then omitting it does not alter current behavior.\n> \n> Example:\n> \n> https://semver.io/node/resolve?range=>%3D4.0.0\n> 5.0.0\n> \n> https://semver.io/node/resolve?range=>%3D4.0.0&v=4.2.1\n> 4.2.1\n> \n> https://semver.io/node/resolve?range=>%3D4.0.0&v=4.0.0&v=4.1.0&v=4.2.1\n> 4.2.1\n> \n> https://semver.io/node/resolve?range=>%3D4.0.0&v=0.10.0&v=0.12.0\n> 5.0.0\n> Thoughts?\n> \n> —\n> Reply to this email directly or view it on GitHub.\n> \n"}}