{"action":"created","issue":{"url":"https://api.github.com/repos/nodejs/node/issues/6587","repository_url":"https://api.github.com/repos/nodejs/node","labels_url":"https://api.github.com/repos/nodejs/node/issues/6587/labels{/name}","comments_url":"https://api.github.com/repos/nodejs/node/issues/6587/comments","events_url":"https://api.github.com/repos/nodejs/node/issues/6587/events","html_url":"https://github.com/nodejs/node/issues/6587","id":153151254,"number":6587,"title":"Why path.basename behaves differently by platform?","user":{"login":"sttk","id":8656098,"avatar_url":"https://avatars.githubusercontent.com/u/8656098?v=3","gravatar_id":"","url":"https://api.github.com/users/sttk","html_url":"https://github.com/sttk","followers_url":"https://api.github.com/users/sttk/followers","following_url":"https://api.github.com/users/sttk/following{/other_user}","gists_url":"https://api.github.com/users/sttk/gists{/gist_id}","starred_url":"https://api.github.com/users/sttk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sttk/subscriptions","organizations_url":"https://api.github.com/users/sttk/orgs","repos_url":"https://api.github.com/users/sttk/repos","events_url":"https://api.github.com/users/sttk/events{/privacy}","received_events_url":"https://api.github.com/users/sttk/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/nodejs/node/labels/path","name":"path","color":"bfe5bf"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-05-05T01:30:24Z","updated_at":"2016-05-05T01:36:59Z","closed_at":null,"body":"* **Version**: 0.10, 0.11, 4, 5, 6\r\n* **Platform**: darwin, linux, win32\r\n* **Subsystem**: path\r\n\r\n--\r\n1. When path is non-string\r\n\r\n   ```js\r\n   [darwin] path.basename(null);  // => TypeError\r\n   [linux]  path.basename(null);  // => 'null'\r\n   [win32]  path.basename(null);  // => 'null'\r\n\r\n   [darwin] path.basename(123);  // => TypeError\r\n   [linux]  path.basename(123);  // => '123'\r\n   [win32]  path.basename(123);  // => '123'\r\n   ```\r\n\r\n2. When ext matches path's tail and contains a path separator.\r\n\r\n   ```js\r\n   [darwin] path.basename('aaa/bbb', '/bbb');   // => ''\r\n   [linux]  path.basename('aaa/bbb', '/bbb');   // => ''\r\n   [win32]  path.basename('aaa/bbb', '/bbb');   // => 'bbb'\r\n   [win32]  path.basename('aaa\\\\bbb', '\\\\bbb'); // => 'bbb'\r\n\r\n   [darwin] path.basename('aaa/bbb', 'a/bbb');   // => ''\r\n   [linux]  path.basename('aaa/bbb', 'a/bbb');   // => ''\r\n   [win32]  path.basename('aaa/bbb', 'a/bbb');   // => 'bbb'\r\n   [win32]  path.basename('aaa\\\\bbb', 'a\\\\bbb'); // => 'bbb'\r\n   ```\r\n\r\n   FYI, `basename` command behaves as follows (I checked on `darwin` and `linux`):\r\n\r\n   ```\r\n   $ basename aaa/bbb bbb\r\n   bbb\r\n   $ basename aaa/bbb /bbb\r\n   bbb\r\n   $ basename aaa/bbb a/bbb\r\n   bbb\r\n   ```\r\n"},"comment":{"url":"https://api.github.com/repos/nodejs/node/issues/comments/217055457","html_url":"https://github.com/nodejs/node/issues/6587#issuecomment-217055457","issue_url":"https://api.github.com/repos/nodejs/node/issues/6587","id":217055457,"user":{"login":"addaleax","id":899444,"avatar_url":"https://avatars.githubusercontent.com/u/899444?v=3","gravatar_id":"","url":"https://api.github.com/users/addaleax","html_url":"https://github.com/addaleax","followers_url":"https://api.github.com/users/addaleax/followers","following_url":"https://api.github.com/users/addaleax/following{/other_user}","gists_url":"https://api.github.com/users/addaleax/gists{/gist_id}","starred_url":"https://api.github.com/users/addaleax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/addaleax/subscriptions","organizations_url":"https://api.github.com/users/addaleax/orgs","repos_url":"https://api.github.com/users/addaleax/repos","events_url":"https://api.github.com/users/addaleax/events{/privacy}","received_events_url":"https://api.github.com/users/addaleax/received_events","type":"User","site_admin":false},"created_at":"2016-05-05T01:36:59Z","updated_at":"2016-05-05T01:36:59Z","body":"I think 1. can be considered fixed in v6.0.0 in the sense that those always throw a `TypeError` now. 2. is certainly a bit more interesting, although I can’t really tell what the expected behaviour in such a case might be."}}