{"action":"created","comment":{"url":"https://api.github.com/repos/Samsung/iotjs/pulls/comments/233393072","pull_request_review_id":174793357,"id":233393072,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzMzM5MzA3Mg==","diff_hunk":"@@ -687,6 +687,73 @@ JS_FUNCTION(ByteLength) {\n }\n \n \n+JS_FUNCTION(FromArrayBuffer) {\n+  if (jargc < 1 || !jerry_value_is_arraybuffer(jargv[0])) {\n+    return jerry_create_undefined();\n+  }\n+  jerry_length_t offset = 0;\n+  jerry_length_t length = jerry_get_arraybuffer_byte_length(jargv[0]);\n+\n+  if (jargc >= 2) {\n+    jerry_value_t offset_num = jerry_value_to_number(jargv[1]);\n+\n+    if (jerry_value_is_error(offset_num)) {\n+      return offset_num;\n+    }\n+\n+    double offset_value = jerry_get_number_value(offset_num);\n+    if (isnan(offset_value)) {\n+      offset_value = 0;\n+    }\n+    jerry_release_value(offset_num);\n+\n+    if (offset_value == length) {\n+      offset = length;\n+    } else if (offset_value >= 0 && offset_value < length) {\n+      offset = (jerry_length_t)offset_value;\n+    } else {\n+      return JS_CREATE_ERROR(RANGE, \"'offset' is out of bounds\");\n+    }\n+  }\n+\n+  length -= offset;\n+\n+  if (jargc >= 3) {\n+    if (jerry_value_is_error(jargv[2])) {\n+      return length;\n+    }\n+\n+    double length_value = (double)length;\n+\n+    if (jerry_value_is_number(jargv[2])) {","path":"src/modules/iotjs_module_buffer.c","position":42,"original_position":42,"commit_id":"a5278f4b2e24e08f66fe4291182e913cbe8cb4af","original_commit_id":"a5278f4b2e24e08f66fe4291182e913cbe8cb4af","user":{"login":"Achie72","id":15895931,"node_id":"MDQ6VXNlcjE1ODk1OTMx","avatar_url":"https://avatars3.githubusercontent.com/u/15895931?v=4","gravatar_id":"","url":"https://api.github.com/users/Achie72","html_url":"https://github.com/Achie72","followers_url":"https://api.github.com/users/Achie72/followers","following_url":"https://api.github.com/users/Achie72/following{/other_user}","gists_url":"https://api.github.com/users/Achie72/gists{/gist_id}","starred_url":"https://api.github.com/users/Achie72/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Achie72/subscriptions","organizations_url":"https://api.github.com/users/Achie72/orgs","repos_url":"https://api.github.com/users/Achie72/repos","events_url":"https://api.github.com/users/Achie72/events{/privacy}","received_events_url":"https://api.github.com/users/Achie72/received_events","type":"User","site_admin":false},"body":"At this point i cannot call `toNumber`. If an undefined value will come in `jargv[2]` it will convert into NaN with the `toNumber` call, as far as i know. After that i cannot differentiate what was originally an undefined and now is NaN, and what was originally NaN too. Node.js handles these cases differently, and for compatibility reasons i wanted to do the same thing.","created_at":"2018-11-14T10:35:39Z","updated_at":"2018-11-14T10:35:39Z","html_url":"https://github.com/Samsung/iotjs/pull/1786#discussion_r233393072","pull_request_url":"https://api.github.com/repos/Samsung/iotjs/pulls/1786","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/Samsung/iotjs/pulls/comments/233393072"},"html":{"href":"https://github.com/Samsung/iotjs/pull/1786#discussion_r233393072"},"pull_request":{"href":"https://api.github.com/repos/Samsung/iotjs/pulls/1786"}},"in_reply_to_id":232960597},"pull_request":{"url":"https://api.github.com/repos/Samsung/iotjs/pulls/1786","id":227307309,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI3MzA3MzA5","html_url":"https://github.com/Samsung/iotjs/pull/1786","diff_url":"https://github.com/Samsung/iotjs/pull/1786.diff","patch_url":"https://github.com/Samsung/iotjs/pull/1786.patch","issue_url":"https://api.github.com/repos/Samsung/iotjs/issues/1786","number":1786,"state":"open","locked":false,"title":"Add Buffer.from method","user":{"login":"Achie72","id":15895931,"node_id":"MDQ6VXNlcjE1ODk1OTMx","avatar_url":"https://avatars3.githubusercontent.com/u/15895931?v=4","gravatar_id":"","url":"https://api.github.com/users/Achie72","html_url":"https://github.com/Achie72","followers_url":"https://api.github.com/users/Achie72/followers","following_url":"https://api.github.com/users/Achie72/following{/other_user}","gists_url":"https://api.github.com/users/Achie72/gists{/gist_id}","starred_url":"https://api.github.com/users/Achie72/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Achie72/subscriptions","organizations_url":"https://api.github.com/users/Achie72/orgs","repos_url":"https://api.github.com/users/Achie72/repos","events_url":"https://api.github.com/users/Achie72/events{/privacy}","received_events_url":"https://api.github.com/users/Achie72/received_events","type":"User","site_admin":false},"body":"Added the Buffer.from() into IoT.js. Documentation and tests also added.\r\nRelated issue: #628\r\n\r\nIoT.js-DCO-1.0-Signed-off-by: Bela Toth tbela@inf.u-szeged.hu","created_at":"2018-10-31T14:27:59Z","updated_at":"2018-11-14T10:35:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"33f2b0eb3c6d8e070e95a0fe66ed8ce70be47ebb","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/Samsung/iotjs/pulls/1786/commits","review_comments_url":"https://api.github.com/repos/Samsung/iotjs/pulls/1786/comments","review_comment_url":"https://api.github.com/repos/Samsung/iotjs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Samsung/iotjs/issues/1786/comments","statuses_url":"https://api.github.com/repos/Samsung/iotjs/statuses/a5278f4b2e24e08f66fe4291182e913cbe8cb4af","head":{"label":"Achie72:bufferFrom","ref":"bufferFrom","sha":"a5278f4b2e24e08f66fe4291182e913cbe8cb4af","user":{"login":"Achie72","id":15895931,"node_id":"MDQ6VXNlcjE1ODk1OTMx","avatar_url":"https://avatars3.githubusercontent.com/u/15895931?v=4","gravatar_id":"","url":"https://api.github.com/users/Achie72","html_url":"https://github.com/Achie72","followers_url":"https://api.github.com/users/Achie72/followers","following_url":"https://api.github.com/users/Achie72/following{/other_user}","gists_url":"https://api.github.com/users/Achie72/gists{/gist_id}","starred_url":"https://api.github.com/users/Achie72/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Achie72/subscriptions","organizations_url":"https://api.github.com/users/Achie72/orgs","repos_url":"https://api.github.com/users/Achie72/repos","events_url":"https://api.github.com/users/Achie72/events{/privacy}","received_events_url":"https://api.github.com/users/Achie72/received_events","type":"User","site_admin":false},"repo":{"id":122458176,"node_id":"MDEwOlJlcG9zaXRvcnkxMjI0NTgxNzY=","name":"iotjs","full_name":"Achie72/iotjs","private":false,"owner":{"login":"Achie72","id":15895931,"node_id":"MDQ6VXNlcjE1ODk1OTMx","avatar_url":"https://avatars3.githubusercontent.com/u/15895931?v=4","gravatar_id":"","url":"https://api.github.com/users/Achie72","html_url":"https://github.com/Achie72","followers_url":"https://api.github.com/users/Achie72/followers","following_url":"https://api.github.com/users/Achie72/following{/other_user}","gists_url":"https://api.github.com/users/Achie72/gists{/gist_id}","starred_url":"https://api.github.com/users/Achie72/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Achie72/subscriptions","organizations_url":"https://api.github.com/users/Achie72/orgs","repos_url":"https://api.github.com/users/Achie72/repos","events_url":"https://api.github.com/users/Achie72/events{/privacy}","received_events_url":"https://api.github.com/users/Achie72/received_events","type":"User","site_admin":false},"html_url":"https://github.com/Achie72/iotjs","description":"Platform for Internet of Things with JavaScript http://www.iotjs.net ","fork":true,"url":"https://api.github.com/repos/Achie72/iotjs","forks_url":"https://api.github.com/repos/Achie72/iotjs/forks","keys_url":"https://api.github.com/repos/Achie72/iotjs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Achie72/iotjs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Achie72/iotjs/teams","hooks_url":"https://api.github.com/repos/Achie72/iotjs/hooks","issue_events_url":"https://api.github.com/repos/Achie72/iotjs/issues/events{/number}","events_url":"https://api.github.com/repos/Achie72/iotjs/events","assignees_url":"https://api.github.com/repos/Achie72/iotjs/assignees{/user}","branches_url":"https://api.github.com/repos/Achie72/iotjs/branches{/branch}","tags_url":"https://api.github.com/repos/Achie72/iotjs/tags","blobs_url":"https://api.github.com/repos/Achie72/iotjs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Achie72/iotjs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Achie72/iotjs/git/refs{/sha}","trees_url":"https://api.github.com/repos/Achie72/iotjs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Achie72/iotjs/statuses/{sha}","languages_url":"https://api.github.com/repos/Achie72/iotjs/languages","stargazers_url":"https://api.github.com/repos/Achie72/iotjs/stargazers","contributors_url":"https://api.github.com/repos/Achie72/iotjs/contributors","subscribers_url":"https://api.github.com/repos/Achie72/iotjs/subscribers","subscription_url":"https://api.github.com/repos/Achie72/iotjs/subscription","commits_url":"https://api.github.com/repos/Achie72/iotjs/commits{/sha}","git_commits_url":"https://api.github.com/repos/Achie72/iotjs/git/commits{/sha}","comments_url":"https://api.github.com/repos/Achie72/iotjs/comments{/number}","issue_comment_url":"https://api.github.com/repos/Achie72/iotjs/issues/comments{/number}","contents_url":"https://api.github.com/repos/Achie72/iotjs/contents/{+path}","compare_url":"https://api.github.com/repos/Achie72/iotjs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Achie72/iotjs/merges","archive_url":"https://api.github.com/repos/Achie72/iotjs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Achie72/iotjs/downloads","issues_url":"https://api.github.com/repos/Achie72/iotjs/issues{/number}","pulls_url":"https://api.github.com/repos/Achie72/iotjs/pulls{/number}","milestones_url":"https://api.github.com/repos/Achie72/iotjs/milestones{/number}","notifications_url":"https://api.github.com/repos/Achie72/iotjs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Achie72/iotjs/labels{/name}","releases_url":"https://api.github.com/repos/Achie72/iotjs/releases{/id}","deployments_url":"https://api.github.com/repos/Achie72/iotjs/deployments","created_at":"2018-02-22T09:38:05Z","updated_at":"2018-02-22T09:38:07Z","pushed_at":"2018-11-13T08:15:14Z","git_url":"git://github.com/Achie72/iotjs.git","ssh_url":"git@github.com:Achie72/iotjs.git","clone_url":"https://github.com/Achie72/iotjs.git","svn_url":"https://github.com/Achie72/iotjs","homepage":"","size":64321,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Samsung:master","ref":"master","sha":"599c56eab1213eb43cc9c2f22941e8782d3d7c97","user":{"login":"Samsung","id":6210390,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYyMTAzOTA=","avatar_url":"https://avatars3.githubusercontent.com/u/6210390?v=4","gravatar_id":"","url":"https://api.github.com/users/Samsung","html_url":"https://github.com/Samsung","followers_url":"https://api.github.com/users/Samsung/followers","following_url":"https://api.github.com/users/Samsung/following{/other_user}","gists_url":"https://api.github.com/users/Samsung/gists{/gist_id}","starred_url":"https://api.github.com/users/Samsung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Samsung/subscriptions","organizations_url":"https://api.github.com/users/Samsung/orgs","repos_url":"https://api.github.com/users/Samsung/repos","events_url":"https://api.github.com/users/Samsung/events{/privacy}","received_events_url":"https://api.github.com/users/Samsung/received_events","type":"Organization","site_admin":false},"repo":{"id":33589470,"node_id":"MDEwOlJlcG9zaXRvcnkzMzU4OTQ3MA==","name":"iotjs","full_name":"Samsung/iotjs","private":false,"owner":{"login":"Samsung","id":6210390,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYyMTAzOTA=","avatar_url":"https://avatars3.githubusercontent.com/u/6210390?v=4","gravatar_id":"","url":"https://api.github.com/users/Samsung","html_url":"https://github.com/Samsung","followers_url":"https://api.github.com/users/Samsung/followers","following_url":"https://api.github.com/users/Samsung/following{/other_user}","gists_url":"https://api.github.com/users/Samsung/gists{/gist_id}","starred_url":"https://api.github.com/users/Samsung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Samsung/subscriptions","organizations_url":"https://api.github.com/users/Samsung/orgs","repos_url":"https://api.github.com/users/Samsung/repos","events_url":"https://api.github.com/users/Samsung/events{/privacy}","received_events_url":"https://api.github.com/users/Samsung/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/Samsung/iotjs","description":"Platform for Internet of Things with JavaScript http://www.iotjs.net ","fork":false,"url":"https://api.github.com/repos/Samsung/iotjs","forks_url":"https://api.github.com/repos/Samsung/iotjs/forks","keys_url":"https://api.github.com/repos/Samsung/iotjs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Samsung/iotjs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Samsung/iotjs/teams","hooks_url":"https://api.github.com/repos/Samsung/iotjs/hooks","issue_events_url":"https://api.github.com/repos/Samsung/iotjs/issues/events{/number}","events_url":"https://api.github.com/repos/Samsung/iotjs/events","assignees_url":"https://api.github.com/repos/Samsung/iotjs/assignees{/user}","branches_url":"https://api.github.com/repos/Samsung/iotjs/branches{/branch}","tags_url":"https://api.github.com/repos/Samsung/iotjs/tags","blobs_url":"https://api.github.com/repos/Samsung/iotjs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Samsung/iotjs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Samsung/iotjs/git/refs{/sha}","trees_url":"https://api.github.com/repos/Samsung/iotjs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Samsung/iotjs/statuses/{sha}","languages_url":"https://api.github.com/repos/Samsung/iotjs/languages","stargazers_url":"https://api.github.com/repos/Samsung/iotjs/stargazers","contributors_url":"https://api.github.com/repos/Samsung/iotjs/contributors","subscribers_url":"https://api.github.com/repos/Samsung/iotjs/subscribers","subscription_url":"https://api.github.com/repos/Samsung/iotjs/subscription","commits_url":"https://api.github.com/repos/Samsung/iotjs/commits{/sha}","git_commits_url":"https://api.github.com/repos/Samsung/iotjs/git/commits{/sha}","comments_url":"https://api.github.com/repos/Samsung/iotjs/comments{/number}","issue_comment_url":"https://api.github.com/repos/Samsung/iotjs/issues/comments{/number}","contents_url":"https://api.github.com/repos/Samsung/iotjs/contents/{+path}","compare_url":"https://api.github.com/repos/Samsung/iotjs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Samsung/iotjs/merges","archive_url":"https://api.github.com/repos/Samsung/iotjs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Samsung/iotjs/downloads","issues_url":"https://api.github.com/repos/Samsung/iotjs/issues{/number}","pulls_url":"https://api.github.com/repos/Samsung/iotjs/pulls{/number}","milestones_url":"https://api.github.com/repos/Samsung/iotjs/milestones{/number}","notifications_url":"https://api.github.com/repos/Samsung/iotjs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Samsung/iotjs/labels{/name}","releases_url":"https://api.github.com/repos/Samsung/iotjs/releases{/id}","deployments_url":"https://api.github.com/repos/Samsung/iotjs/deployments","created_at":"2015-04-08T06:41:39Z","updated_at":"2018-11-14T07:29:56Z","pushed_at":"2018-11-14T10:26:04Z","git_url":"git://github.com/Samsung/iotjs.git","ssh_url":"git@github.com:Samsung/iotjs.git","clone_url":"https://github.com/Samsung/iotjs.git","svn_url":"https://github.com/Samsung/iotjs","homepage":"","size":64344,"stargazers_count":1882,"watchers_count":1882,"language":"JavaScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":356,"mirror_url":null,"archived":false,"open_issues_count":25,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":356,"open_issues":25,"watchers":1882,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Samsung/iotjs/pulls/1786"},"html":{"href":"https://github.com/Samsung/iotjs/pull/1786"},"issue":{"href":"https://api.github.com/repos/Samsung/iotjs/issues/1786"},"comments":{"href":"https://api.github.com/repos/Samsung/iotjs/issues/1786/comments"},"review_comments":{"href":"https://api.github.com/repos/Samsung/iotjs/pulls/1786/comments"},"review_comment":{"href":"https://api.github.com/repos/Samsung/iotjs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Samsung/iotjs/pulls/1786/commits"},"statuses":{"href":"https://api.github.com/repos/Samsung/iotjs/statuses/a5278f4b2e24e08f66fe4291182e913cbe8cb4af"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"Achie72"}}