{"action":"created","issue":{"url":"https://api.github.com/repos/ModuleLoader/es6-module-loader/issues/350","labels_url":"https://api.github.com/repos/ModuleLoader/es6-module-loader/issues/350/labels{/name}","comments_url":"https://api.github.com/repos/ModuleLoader/es6-module-loader/issues/350/comments","events_url":"https://api.github.com/repos/ModuleLoader/es6-module-loader/issues/350/events","html_url":"https://github.com/ModuleLoader/es6-module-loader/pull/350","id":66916987,"number":350,"title":"Improve path matching","user":{"login":"crisptrutski","id":881351,"avatar_url":"https://avatars.githubusercontent.com/u/881351?v=3","gravatar_id":"","url":"https://api.github.com/users/crisptrutski","html_url":"https://github.com/crisptrutski","followers_url":"https://api.github.com/users/crisptrutski/followers","following_url":"https://api.github.com/users/crisptrutski/following{/other_user}","gists_url":"https://api.github.com/users/crisptrutski/gists{/gist_id}","starred_url":"https://api.github.com/users/crisptrutski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crisptrutski/subscriptions","organizations_url":"https://api.github.com/users/crisptrutski/orgs","repos_url":"https://api.github.com/users/crisptrutski/repos","events_url":"https://api.github.com/users/crisptrutski/events{/privacy}","received_events_url":"https://api.github.com/users/crisptrutski/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-04-07T15:31:30Z","updated_at":"2015-04-07T15:31:48Z","closed_at":"2015-04-07T15:31:48Z","pull_request":{"url":"https://api.github.com/repos/ModuleLoader/es6-module-loader/pulls/350","html_url":"https://github.com/ModuleLoader/es6-module-loader/pull/350","diff_url":"https://github.com/ModuleLoader/es6-module-loader/pull/350.diff","patch_url":"https://github.com/ModuleLoader/es6-module-loader/pull/350.patch"},"body":"There were some issues with the existing code:\r\n\r\n1. Contrary to documentation, \"last match\" would always win for wildcard matches\r\n2. Exact matches worried about match length, which made no sense as this could match once only\r\n\r\nAdditionally, @guybedford suggested looking at \"length\" in terms of path depth (ie. number of slashes) rather than string length of the pattern.\r\n\r\nThis PR updates the `locate` function to address the 3 points above.\r\n\r\nAnother potential change mentioned by @guybedford would be \"first match wins\" for ties, although \"last match wins\" seems the right choice to me. Will add this if wanted though. In either case [the wiki](https://github.com/ModuleLoader/es6-module-loader/wiki/Configuring-the-Loader#paths-implementation) should be updated to mention this decision.\r\n\r\nLeft noise in separate commits, but happy to squash if suitable for inclusion."},"comment":{"url":"https://api.github.com/repos/ModuleLoader/es6-module-loader/issues/comments/90611240","html_url":"https://github.com/ModuleLoader/es6-module-loader/pull/350#issuecomment-90611240","issue_url":"https://api.github.com/repos/ModuleLoader/es6-module-loader/issues/350","id":90611240,"user":{"login":"crisptrutski","id":881351,"avatar_url":"https://avatars.githubusercontent.com/u/881351?v=3","gravatar_id":"","url":"https://api.github.com/users/crisptrutski","html_url":"https://github.com/crisptrutski","followers_url":"https://api.github.com/users/crisptrutski/followers","following_url":"https://api.github.com/users/crisptrutski/following{/other_user}","gists_url":"https://api.github.com/users/crisptrutski/gists{/gist_id}","starred_url":"https://api.github.com/users/crisptrutski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crisptrutski/subscriptions","organizations_url":"https://api.github.com/users/crisptrutski/orgs","repos_url":"https://api.github.com/users/crisptrutski/repos","events_url":"https://api.github.com/users/crisptrutski/events{/privacy}","received_events_url":"https://api.github.com/users/crisptrutski/received_events","type":"User","site_admin":false},"created_at":"2015-04-07T15:31:48Z","updated_at":"2015-04-07T15:31:48Z","body":"D'oh wrong target"}}