{"action":"created","comment":{"url":"https://api.github.com/repos/nodejs/node/pulls/comments/56936009","id":56936009,"diff_hunk":"@@ -317,11 +317,12 @@ function base64ByteLength(str, bytes) {\n \n \n function byteLength(string, encoding) {\n-  if (string instanceof Buffer)\n-    return string.length;\n+  if (typeof string !== 'string') {\n+    if (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)\n+      return string.byteLength;\n \n-  if (typeof string !== 'string')\n     string = '' + string;","path":"lib/buffer.js","position":11,"original_position":11,"commit_id":"a5c5d7092b4a9048acabc43994c91a73f1572a29","original_commit_id":"a5c5d7092b4a9048acabc43994c91a73f1572a29","user":{"login":"jasnell","id":439929,"avatar_url":"https://avatars.githubusercontent.com/u/439929?v=3","gravatar_id":"","url":"https://api.github.com/users/jasnell","html_url":"https://github.com/jasnell","followers_url":"https://api.github.com/users/jasnell/followers","following_url":"https://api.github.com/users/jasnell/following{/other_user}","gists_url":"https://api.github.com/users/jasnell/gists{/gist_id}","starred_url":"https://api.github.com/users/jasnell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasnell/subscriptions","organizations_url":"https://api.github.com/users/jasnell/orgs","repos_url":"https://api.github.com/users/jasnell/repos","events_url":"https://api.github.com/users/jasnell/events{/privacy}","received_events_url":"https://api.github.com/users/jasnell/received_events","type":"User","site_admin":false},"body":"nit: `string += ''` works too","created_at":"2016-03-22T04:25:33Z","updated_at":"2016-03-22T04:25:33Z","html_url":"https://github.com/nodejs/node/pull/5255#discussion_r56936009","pull_request_url":"https://api.github.com/repos/nodejs/node/pulls/5255","_links":{"self":{"href":"https://api.github.com/repos/nodejs/node/pulls/comments/56936009"},"html":{"href":"https://github.com/nodejs/node/pull/5255#discussion_r56936009"},"pull_request":{"href":"https://api.github.com/repos/nodejs/node/pulls/5255"}}},"pull_request":{"url":"https://api.github.com/repos/nodejs/node/pulls/5255","id":59445567,"html_url":"https://github.com/nodejs/node/pull/5255","diff_url":"https://github.com/nodejs/node/pull/5255.diff","patch_url":"https://github.com/nodejs/node/pull/5255.patch","issue_url":"https://api.github.com/repos/nodejs/node/issues/5255","number":5255,"state":"open","locked":false,"title":"buffer: make byteLength work with ArrayBuffer & DataView","user":{"login":"JacksonTian","id":327019,"avatar_url":"https://avatars.githubusercontent.com/u/327019?v=3","gravatar_id":"","url":"https://api.github.com/users/JacksonTian","html_url":"https://github.com/JacksonTian","followers_url":"https://api.github.com/users/JacksonTian/followers","following_url":"https://api.github.com/users/JacksonTian/following{/other_user}","gists_url":"https://api.github.com/users/JacksonTian/gists{/gist_id}","starred_url":"https://api.github.com/users/JacksonTian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JacksonTian/subscriptions","organizations_url":"https://api.github.com/users/JacksonTian/orgs","repos_url":"https://api.github.com/users/JacksonTian/repos","events_url":"https://api.github.com/users/JacksonTian/events{/privacy}","received_events_url":"https://api.github.com/users/JacksonTian/received_events","type":"User","site_admin":false},"body":"Convert anything to string, but Buffer, TypedArray and ArrayBuffer","created_at":"2016-02-16T05:33:43Z","updated_at":"2016-03-22T04:25:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"07efa70170e67f903a591a9c90a0bdca0c6c05ee","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/nodejs/node/pulls/5255/commits","review_comments_url":"https://api.github.com/repos/nodejs/node/pulls/5255/comments","review_comment_url":"https://api.github.com/repos/nodejs/node/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nodejs/node/issues/5255/comments","statuses_url":"https://api.github.com/repos/nodejs/node/statuses/a5c5d7092b4a9048acabc43994c91a73f1572a29","head":{"label":"JacksonTian:byteLength","ref":"byteLength","sha":"a5c5d7092b4a9048acabc43994c91a73f1572a29","user":{"login":"JacksonTian","id":327019,"avatar_url":"https://avatars.githubusercontent.com/u/327019?v=3","gravatar_id":"","url":"https://api.github.com/users/JacksonTian","html_url":"https://github.com/JacksonTian","followers_url":"https://api.github.com/users/JacksonTian/followers","following_url":"https://api.github.com/users/JacksonTian/following{/other_user}","gists_url":"https://api.github.com/users/JacksonTian/gists{/gist_id}","starred_url":"https://api.github.com/users/JacksonTian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JacksonTian/subscriptions","organizations_url":"https://api.github.com/users/JacksonTian/orgs","repos_url":"https://api.github.com/users/JacksonTian/repos","events_url":"https://api.github.com/users/JacksonTian/events{/privacy}","received_events_url":"https://api.github.com/users/JacksonTian/received_events","type":"User","site_admin":false},"repo":{"id":28173772,"name":"node","full_name":"JacksonTian/node","owner":{"login":"JacksonTian","id":327019,"avatar_url":"https://avatars.githubusercontent.com/u/327019?v=3","gravatar_id":"","url":"https://api.github.com/users/JacksonTian","html_url":"https://github.com/JacksonTian","followers_url":"https://api.github.com/users/JacksonTian/followers","following_url":"https://api.github.com/users/JacksonTian/following{/other_user}","gists_url":"https://api.github.com/users/JacksonTian/gists{/gist_id}","starred_url":"https://api.github.com/users/JacksonTian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JacksonTian/subscriptions","organizations_url":"https://api.github.com/users/JacksonTian/orgs","repos_url":"https://api.github.com/users/JacksonTian/repos","events_url":"https://api.github.com/users/JacksonTian/events{/privacy}","received_events_url":"https://api.github.com/users/JacksonTian/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/JacksonTian/node","description":"Evented IO for V8 JavaScript","fork":true,"url":"https://api.github.com/repos/JacksonTian/node","forks_url":"https://api.github.com/repos/JacksonTian/node/forks","keys_url":"https://api.github.com/repos/JacksonTian/node/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JacksonTian/node/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JacksonTian/node/teams","hooks_url":"https://api.github.com/repos/JacksonTian/node/hooks","issue_events_url":"https://api.github.com/repos/JacksonTian/node/issues/events{/number}","events_url":"https://api.github.com/repos/JacksonTian/node/events","assignees_url":"https://api.github.com/repos/JacksonTian/node/assignees{/user}","branches_url":"https://api.github.com/repos/JacksonTian/node/branches{/branch}","tags_url":"https://api.github.com/repos/JacksonTian/node/tags","blobs_url":"https://api.github.com/repos/JacksonTian/node/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JacksonTian/node/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JacksonTian/node/git/refs{/sha}","trees_url":"https://api.github.com/repos/JacksonTian/node/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JacksonTian/node/statuses/{sha}","languages_url":"https://api.github.com/repos/JacksonTian/node/languages","stargazers_url":"https://api.github.com/repos/JacksonTian/node/stargazers","contributors_url":"https://api.github.com/repos/JacksonTian/node/contributors","subscribers_url":"https://api.github.com/repos/JacksonTian/node/subscribers","subscription_url":"https://api.github.com/repos/JacksonTian/node/subscription","commits_url":"https://api.github.com/repos/JacksonTian/node/commits{/sha}","git_commits_url":"https://api.github.com/repos/JacksonTian/node/git/commits{/sha}","comments_url":"https://api.github.com/repos/JacksonTian/node/comments{/number}","issue_comment_url":"https://api.github.com/repos/JacksonTian/node/issues/comments{/number}","contents_url":"https://api.github.com/repos/JacksonTian/node/contents/{+path}","compare_url":"https://api.github.com/repos/JacksonTian/node/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JacksonTian/node/merges","archive_url":"https://api.github.com/repos/JacksonTian/node/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JacksonTian/node/downloads","issues_url":"https://api.github.com/repos/JacksonTian/node/issues{/number}","pulls_url":"https://api.github.com/repos/JacksonTian/node/pulls{/number}","milestones_url":"https://api.github.com/repos/JacksonTian/node/milestones{/number}","notifications_url":"https://api.github.com/repos/JacksonTian/node/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JacksonTian/node/labels{/name}","releases_url":"https://api.github.com/repos/JacksonTian/node/releases{/id}","deployments_url":"https://api.github.com/repos/JacksonTian/node/deployments","created_at":"2014-12-18T07:50:35Z","updated_at":"2016-01-15T08:08:45Z","pushed_at":"2016-03-22T04:04:03Z","git_url":"git://github.com/JacksonTian/node.git","ssh_url":"git@github.com:JacksonTian/node.git","clone_url":"https://github.com/JacksonTian/node.git","svn_url":"https://github.com/JacksonTian/node","homepage":null,"size":181074,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"nodejs:master","ref":"master","sha":"6a3d38f00f116cbe51cd006ee558ca773522e6f5","user":{"login":"nodejs","id":9950313,"avatar_url":"https://avatars.githubusercontent.com/u/9950313?v=3","gravatar_id":"","url":"https://api.github.com/users/nodejs","html_url":"https://github.com/nodejs","followers_url":"https://api.github.com/users/nodejs/followers","following_url":"https://api.github.com/users/nodejs/following{/other_user}","gists_url":"https://api.github.com/users/nodejs/gists{/gist_id}","starred_url":"https://api.github.com/users/nodejs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nodejs/subscriptions","organizations_url":"https://api.github.com/users/nodejs/orgs","repos_url":"https://api.github.com/users/nodejs/repos","events_url":"https://api.github.com/users/nodejs/events{/privacy}","received_events_url":"https://api.github.com/users/nodejs/received_events","type":"Organization","site_admin":false},"repo":{"id":27193779,"name":"node","full_name":"nodejs/node","owner":{"login":"nodejs","id":9950313,"avatar_url":"https://avatars.githubusercontent.com/u/9950313?v=3","gravatar_id":"","url":"https://api.github.com/users/nodejs","html_url":"https://github.com/nodejs","followers_url":"https://api.github.com/users/nodejs/followers","following_url":"https://api.github.com/users/nodejs/following{/other_user}","gists_url":"https://api.github.com/users/nodejs/gists{/gist_id}","starred_url":"https://api.github.com/users/nodejs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nodejs/subscriptions","organizations_url":"https://api.github.com/users/nodejs/orgs","repos_url":"https://api.github.com/users/nodejs/repos","events_url":"https://api.github.com/users/nodejs/events{/privacy}","received_events_url":"https://api.github.com/users/nodejs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nodejs/node","description":"Node.js JavaScript runtime :sparkles::turtle::rocket::sparkles:","fork":false,"url":"https://api.github.com/repos/nodejs/node","forks_url":"https://api.github.com/repos/nodejs/node/forks","keys_url":"https://api.github.com/repos/nodejs/node/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nodejs/node/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nodejs/node/teams","hooks_url":"https://api.github.com/repos/nodejs/node/hooks","issue_events_url":"https://api.github.com/repos/nodejs/node/issues/events{/number}","events_url":"https://api.github.com/repos/nodejs/node/events","assignees_url":"https://api.github.com/repos/nodejs/node/assignees{/user}","branches_url":"https://api.github.com/repos/nodejs/node/branches{/branch}","tags_url":"https://api.github.com/repos/nodejs/node/tags","blobs_url":"https://api.github.com/repos/nodejs/node/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nodejs/node/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nodejs/node/git/refs{/sha}","trees_url":"https://api.github.com/repos/nodejs/node/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nodejs/node/statuses/{sha}","languages_url":"https://api.github.com/repos/nodejs/node/languages","stargazers_url":"https://api.github.com/repos/nodejs/node/stargazers","contributors_url":"https://api.github.com/repos/nodejs/node/contributors","subscribers_url":"https://api.github.com/repos/nodejs/node/subscribers","subscription_url":"https://api.github.com/repos/nodejs/node/subscription","commits_url":"https://api.github.com/repos/nodejs/node/commits{/sha}","git_commits_url":"https://api.github.com/repos/nodejs/node/git/commits{/sha}","comments_url":"https://api.github.com/repos/nodejs/node/comments{/number}","issue_comment_url":"https://api.github.com/repos/nodejs/node/issues/comments{/number}","contents_url":"https://api.github.com/repos/nodejs/node/contents/{+path}","compare_url":"https://api.github.com/repos/nodejs/node/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nodejs/node/merges","archive_url":"https://api.github.com/repos/nodejs/node/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nodejs/node/downloads","issues_url":"https://api.github.com/repos/nodejs/node/issues{/number}","pulls_url":"https://api.github.com/repos/nodejs/node/pulls{/number}","milestones_url":"https://api.github.com/repos/nodejs/node/milestones{/number}","notifications_url":"https://api.github.com/repos/nodejs/node/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nodejs/node/labels{/name}","releases_url":"https://api.github.com/repos/nodejs/node/releases{/id}","deployments_url":"https://api.github.com/repos/nodejs/node/deployments","created_at":"2014-11-26T19:57:11Z","updated_at":"2016-03-22T04:15:36Z","pushed_at":"2016-03-22T03:56:37Z","git_url":"git://github.com/nodejs/node.git","ssh_url":"git@github.com:nodejs/node.git","clone_url":"https://github.com/nodejs/node.git","svn_url":"https://github.com/nodejs/node","homepage":"https://nodejs.org","size":226376,"stargazers_count":21310,"watchers_count":21310,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2801,"mirror_url":null,"open_issues_count":745,"forks":2801,"open_issues":745,"watchers":21310,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nodejs/node/pulls/5255"},"html":{"href":"https://github.com/nodejs/node/pull/5255"},"issue":{"href":"https://api.github.com/repos/nodejs/node/issues/5255"},"comments":{"href":"https://api.github.com/repos/nodejs/node/issues/5255/comments"},"review_comments":{"href":"https://api.github.com/repos/nodejs/node/pulls/5255/comments"},"review_comment":{"href":"https://api.github.com/repos/nodejs/node/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nodejs/node/pulls/5255/commits"},"statuses":{"href":"https://api.github.com/repos/nodejs/node/statuses/a5c5d7092b4a9048acabc43994c91a73f1572a29"}}}}