{"action":"created","comment":{"url":"https://api.github.com/repos/LLK/scratch-vm/pulls/comments/81643845","pull_request_review_id":2609139,"id":81643845,"diff_hunk":"@@ -0,0 +1,178 @@\n+var test = require('tap').test;\n+var cast = require('../../src/util/cast');\n+\n+test('toNumber', function (t) {\n+    // Numeric\n+    t.equal(cast.toNumber(0), 0);\n+    t.equal(cast.toNumber(1), 1);\n+    t.equal(cast.toNumber(3.14), 3.14);\n+\n+    // String\n+    t.equal(cast.toNumber('0'), 0);\n+    t.equal(cast.toNumber('1'), 1);\n+    t.equal(cast.toNumber('3.14'), 3.14);\n+    t.equal(cast.toNumber('0.1e10'), 1000000000);\n+    t.equal(cast.toNumber('foobar'), 0);\n+\n+    // Boolean\n+    t.equal(cast.toNumber(true), 1);\n+    t.equal(cast.toNumber(false), 0);\n+    t.equal(cast.toNumber('true'), 0);\n+    t.equal(cast.toNumber('false'), 0);\n+\n+    // Undefined & object\n+    t.equal(cast.toNumber(undefined), 0);\n+    t.equal(cast.toNumber({}), 0);\n+    t.end();","path":"test/unit/util_cast.js","position":26,"original_position":26,"commit_id":"8ca6944292bd18f2e0ae540e1abb59ca884bf35e","original_commit_id":"8ca6944292bd18f2e0ae540e1abb59ca884bf35e","user":{"login":"tmickel","id":120403,"avatar_url":"https://avatars.githubusercontent.com/u/120403?v=3","gravatar_id":"","url":"https://api.github.com/users/tmickel","html_url":"https://github.com/tmickel","followers_url":"https://api.github.com/users/tmickel/followers","following_url":"https://api.github.com/users/tmickel/following{/other_user}","gists_url":"https://api.github.com/users/tmickel/gists{/gist_id}","starred_url":"https://api.github.com/users/tmickel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tmickel/subscriptions","organizations_url":"https://api.github.com/users/tmickel/orgs","repos_url":"https://api.github.com/users/tmickel/repos","events_url":"https://api.github.com/users/tmickel/events{/privacy}","received_events_url":"https://api.github.com/users/tmickel/received_events","type":"User","site_admin":false},"body":"May want to do `t.equal(cast.toNumber(NaN), 0);` since that's specifically dealt with in the function.","created_at":"2016-10-03T21:27:08Z","updated_at":"2016-10-03T21:27:08Z","html_url":"https://github.com/LLK/scratch-vm/pull/228#discussion_r81643845","pull_request_url":"https://api.github.com/repos/LLK/scratch-vm/pulls/228","_links":{"self":{"href":"https://api.github.com/repos/LLK/scratch-vm/pulls/comments/81643845"},"html":{"href":"https://github.com/LLK/scratch-vm/pull/228#discussion_r81643845"},"pull_request":{"href":"https://api.github.com/repos/LLK/scratch-vm/pulls/228"}}},"pull_request":{"url":"https://api.github.com/repos/LLK/scratch-vm/pulls/228","id":87787290,"html_url":"https://github.com/LLK/scratch-vm/pull/228","diff_url":"https://github.com/LLK/scratch-vm/pull/228.diff","patch_url":"https://github.com/LLK/scratch-vm/pull/228.patch","issue_url":"https://api.github.com/repos/LLK/scratch-vm/issues/228","number":228,"state":"open","locked":false,"title":"Add unit tests for all utility modules","user":{"login":"thisandagain","id":747641,"avatar_url":"https://avatars.githubusercontent.com/u/747641?v=3","gravatar_id":"","url":"https://api.github.com/users/thisandagain","html_url":"https://github.com/thisandagain","followers_url":"https://api.github.com/users/thisandagain/followers","following_url":"https://api.github.com/users/thisandagain/following{/other_user}","gists_url":"https://api.github.com/users/thisandagain/gists{/gist_id}","starred_url":"https://api.github.com/users/thisandagain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thisandagain/subscriptions","organizations_url":"https://api.github.com/users/thisandagain/orgs","repos_url":"https://api.github.com/users/thisandagain/repos","events_url":"https://api.github.com/users/thisandagain/events{/privacy}","received_events_url":"https://api.github.com/users/thisandagain/received_events","type":"User","site_admin":false},"body":"Implements one half of GH-103. Will handle blocks (as well as bugs exposed by this PR) in separate PRs.\r\n\r\n## Before\r\n![image](https://cloud.githubusercontent.com/assets/747641/19053186/cc6fab42-8987-11e6-907e-1eb180142d50.png)\r\n![image](https://cloud.githubusercontent.com/assets/747641/19053200/d63673f4-8987-11e6-9791-3fa6e26bce3f.png)\r\n\r\n## After\r\n![image](https://cloud.githubusercontent.com/assets/747641/19053144/9ee7158e-8987-11e6-9d46-fdb930400c31.png)\r\n![image](https://cloud.githubusercontent.com/assets/747641/19053160/ac448d1a-8987-11e6-8a78-74696e037b00.png)\r\n","created_at":"2016-10-03T20:39:27Z","updated_at":"2016-10-03T21:27:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b5673bae60f106d7d7a79878f51fee278f111d93","assignee":{"login":"tmickel","id":120403,"avatar_url":"https://avatars.githubusercontent.com/u/120403?v=3","gravatar_id":"","url":"https://api.github.com/users/tmickel","html_url":"https://github.com/tmickel","followers_url":"https://api.github.com/users/tmickel/followers","following_url":"https://api.github.com/users/tmickel/following{/other_user}","gists_url":"https://api.github.com/users/tmickel/gists{/gist_id}","starred_url":"https://api.github.com/users/tmickel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tmickel/subscriptions","organizations_url":"https://api.github.com/users/tmickel/orgs","repos_url":"https://api.github.com/users/tmickel/repos","events_url":"https://api.github.com/users/tmickel/events{/privacy}","received_events_url":"https://api.github.com/users/tmickel/received_events","type":"User","site_admin":false},"assignees":[{"login":"tmickel","id":120403,"avatar_url":"https://avatars.githubusercontent.com/u/120403?v=3","gravatar_id":"","url":"https://api.github.com/users/tmickel","html_url":"https://github.com/tmickel","followers_url":"https://api.github.com/users/tmickel/followers","following_url":"https://api.github.com/users/tmickel/following{/other_user}","gists_url":"https://api.github.com/users/tmickel/gists{/gist_id}","starred_url":"https://api.github.com/users/tmickel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tmickel/subscriptions","organizations_url":"https://api.github.com/users/tmickel/orgs","repos_url":"https://api.github.com/users/tmickel/repos","events_url":"https://api.github.com/users/tmickel/events{/privacy}","received_events_url":"https://api.github.com/users/tmickel/received_events","type":"User","site_admin":false},{"login":"cwillisf","id":7019101,"avatar_url":"https://avatars.githubusercontent.com/u/7019101?v=3","gravatar_id":"","url":"https://api.github.com/users/cwillisf","html_url":"https://github.com/cwillisf","followers_url":"https://api.github.com/users/cwillisf/followers","following_url":"https://api.github.com/users/cwillisf/following{/other_user}","gists_url":"https://api.github.com/users/cwillisf/gists{/gist_id}","starred_url":"https://api.github.com/users/cwillisf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cwillisf/subscriptions","organizations_url":"https://api.github.com/users/cwillisf/orgs","repos_url":"https://api.github.com/users/cwillisf/repos","events_url":"https://api.github.com/users/cwillisf/events{/privacy}","received_events_url":"https://api.github.com/users/cwillisf/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/LLK/scratch-vm/milestones/6","html_url":"https://github.com/LLK/scratch-vm/milestones/October%2020","labels_url":"https://api.github.com/repos/LLK/scratch-vm/milestones/6/labels","id":1932316,"number":6,"title":"October 20","description":"","creator":{"login":"kaschm","id":782228,"avatar_url":"https://avatars.githubusercontent.com/u/782228?v=3","gravatar_id":"","url":"https://api.github.com/users/kaschm","html_url":"https://github.com/kaschm","followers_url":"https://api.github.com/users/kaschm/followers","following_url":"https://api.github.com/users/kaschm/following{/other_user}","gists_url":"https://api.github.com/users/kaschm/gists{/gist_id}","starred_url":"https://api.github.com/users/kaschm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaschm/subscriptions","organizations_url":"https://api.github.com/users/kaschm/orgs","repos_url":"https://api.github.com/users/kaschm/repos","events_url":"https://api.github.com/users/kaschm/events{/privacy}","received_events_url":"https://api.github.com/users/kaschm/received_events","type":"User","site_admin":false},"open_issues":14,"closed_issues":9,"state":"open","created_at":"2016-08-09T13:34:04Z","updated_at":"2016-10-03T21:07:20Z","due_on":"2016-10-20T04:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/LLK/scratch-vm/pulls/228/commits","review_comments_url":"https://api.github.com/repos/LLK/scratch-vm/pulls/228/comments","review_comment_url":"https://api.github.com/repos/LLK/scratch-vm/pulls/comments{/number}","comments_url":"https://api.github.com/repos/LLK/scratch-vm/issues/228/comments","statuses_url":"https://api.github.com/repos/LLK/scratch-vm/statuses/8ca6944292bd18f2e0ae540e1abb59ca884bf35e","head":{"label":"thisandagain:bugfix/coverage","ref":"bugfix/coverage","sha":"8ca6944292bd18f2e0ae540e1abb59ca884bf35e","user":{"login":"thisandagain","id":747641,"avatar_url":"https://avatars.githubusercontent.com/u/747641?v=3","gravatar_id":"","url":"https://api.github.com/users/thisandagain","html_url":"https://github.com/thisandagain","followers_url":"https://api.github.com/users/thisandagain/followers","following_url":"https://api.github.com/users/thisandagain/following{/other_user}","gists_url":"https://api.github.com/users/thisandagain/gists{/gist_id}","starred_url":"https://api.github.com/users/thisandagain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thisandagain/subscriptions","organizations_url":"https://api.github.com/users/thisandagain/orgs","repos_url":"https://api.github.com/users/thisandagain/repos","events_url":"https://api.github.com/users/thisandagain/events{/privacy}","received_events_url":"https://api.github.com/users/thisandagain/received_events","type":"User","site_admin":false},"repo":{"id":65239525,"name":"scratch-vm","full_name":"thisandagain/scratch-vm","owner":{"login":"thisandagain","id":747641,"avatar_url":"https://avatars.githubusercontent.com/u/747641?v=3","gravatar_id":"","url":"https://api.github.com/users/thisandagain","html_url":"https://github.com/thisandagain","followers_url":"https://api.github.com/users/thisandagain/followers","following_url":"https://api.github.com/users/thisandagain/following{/other_user}","gists_url":"https://api.github.com/users/thisandagain/gists{/gist_id}","starred_url":"https://api.github.com/users/thisandagain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thisandagain/subscriptions","organizations_url":"https://api.github.com/users/thisandagain/orgs","repos_url":"https://api.github.com/users/thisandagain/repos","events_url":"https://api.github.com/users/thisandagain/events{/privacy}","received_events_url":"https://api.github.com/users/thisandagain/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/thisandagain/scratch-vm","description":"Virtual Machine for Scratch Blocks","fork":true,"url":"https://api.github.com/repos/thisandagain/scratch-vm","forks_url":"https://api.github.com/repos/thisandagain/scratch-vm/forks","keys_url":"https://api.github.com/repos/thisandagain/scratch-vm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/thisandagain/scratch-vm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/thisandagain/scratch-vm/teams","hooks_url":"https://api.github.com/repos/thisandagain/scratch-vm/hooks","issue_events_url":"https://api.github.com/repos/thisandagain/scratch-vm/issues/events{/number}","events_url":"https://api.github.com/repos/thisandagain/scratch-vm/events","assignees_url":"https://api.github.com/repos/thisandagain/scratch-vm/assignees{/user}","branches_url":"https://api.github.com/repos/thisandagain/scratch-vm/branches{/branch}","tags_url":"https://api.github.com/repos/thisandagain/scratch-vm/tags","blobs_url":"https://api.github.com/repos/thisandagain/scratch-vm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/thisandagain/scratch-vm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/thisandagain/scratch-vm/git/refs{/sha}","trees_url":"https://api.github.com/repos/thisandagain/scratch-vm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/thisandagain/scratch-vm/statuses/{sha}","languages_url":"https://api.github.com/repos/thisandagain/scratch-vm/languages","stargazers_url":"https://api.github.com/repos/thisandagain/scratch-vm/stargazers","contributors_url":"https://api.github.com/repos/thisandagain/scratch-vm/contributors","subscribers_url":"https://api.github.com/repos/thisandagain/scratch-vm/subscribers","subscription_url":"https://api.github.com/repos/thisandagain/scratch-vm/subscription","commits_url":"https://api.github.com/repos/thisandagain/scratch-vm/commits{/sha}","git_commits_url":"https://api.github.com/repos/thisandagain/scratch-vm/git/commits{/sha}","comments_url":"https://api.github.com/repos/thisandagain/scratch-vm/comments{/number}","issue_comment_url":"https://api.github.com/repos/thisandagain/scratch-vm/issues/comments{/number}","contents_url":"https://api.github.com/repos/thisandagain/scratch-vm/contents/{+path}","compare_url":"https://api.github.com/repos/thisandagain/scratch-vm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/thisandagain/scratch-vm/merges","archive_url":"https://api.github.com/repos/thisandagain/scratch-vm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/thisandagain/scratch-vm/downloads","issues_url":"https://api.github.com/repos/thisandagain/scratch-vm/issues{/number}","pulls_url":"https://api.github.com/repos/thisandagain/scratch-vm/pulls{/number}","milestones_url":"https://api.github.com/repos/thisandagain/scratch-vm/milestones{/number}","notifications_url":"https://api.github.com/repos/thisandagain/scratch-vm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/thisandagain/scratch-vm/labels{/name}","releases_url":"https://api.github.com/repos/thisandagain/scratch-vm/releases{/id}","deployments_url":"https://api.github.com/repos/thisandagain/scratch-vm/deployments","created_at":"2016-08-08T21:09:50Z","updated_at":"2016-08-08T21:09:51Z","pushed_at":"2016-10-03T20:35:09Z","git_url":"git://github.com/thisandagain/scratch-vm.git","ssh_url":"git@github.com:thisandagain/scratch-vm.git","clone_url":"https://github.com/thisandagain/scratch-vm.git","svn_url":"https://github.com/thisandagain/scratch-vm","homepage":"https://scratch.mit.edu/developers","size":467,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"LLK:develop","ref":"develop","sha":"dd624aea06ca12cd887458096829d3a4ba607b9a","user":{"login":"LLK","id":3420800,"avatar_url":"https://avatars.githubusercontent.com/u/3420800?v=3","gravatar_id":"","url":"https://api.github.com/users/LLK","html_url":"https://github.com/LLK","followers_url":"https://api.github.com/users/LLK/followers","following_url":"https://api.github.com/users/LLK/following{/other_user}","gists_url":"https://api.github.com/users/LLK/gists{/gist_id}","starred_url":"https://api.github.com/users/LLK/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LLK/subscriptions","organizations_url":"https://api.github.com/users/LLK/orgs","repos_url":"https://api.github.com/users/LLK/repos","events_url":"https://api.github.com/users/LLK/events{/privacy}","received_events_url":"https://api.github.com/users/LLK/received_events","type":"Organization","site_admin":false},"repo":{"id":55796146,"name":"scratch-vm","full_name":"LLK/scratch-vm","owner":{"login":"LLK","id":3420800,"avatar_url":"https://avatars.githubusercontent.com/u/3420800?v=3","gravatar_id":"","url":"https://api.github.com/users/LLK","html_url":"https://github.com/LLK","followers_url":"https://api.github.com/users/LLK/followers","following_url":"https://api.github.com/users/LLK/following{/other_user}","gists_url":"https://api.github.com/users/LLK/gists{/gist_id}","starred_url":"https://api.github.com/users/LLK/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LLK/subscriptions","organizations_url":"https://api.github.com/users/LLK/orgs","repos_url":"https://api.github.com/users/LLK/repos","events_url":"https://api.github.com/users/LLK/events{/privacy}","received_events_url":"https://api.github.com/users/LLK/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/LLK/scratch-vm","description":"Virtual Machine for Scratch Blocks","fork":false,"url":"https://api.github.com/repos/LLK/scratch-vm","forks_url":"https://api.github.com/repos/LLK/scratch-vm/forks","keys_url":"https://api.github.com/repos/LLK/scratch-vm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/LLK/scratch-vm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/LLK/scratch-vm/teams","hooks_url":"https://api.github.com/repos/LLK/scratch-vm/hooks","issue_events_url":"https://api.github.com/repos/LLK/scratch-vm/issues/events{/number}","events_url":"https://api.github.com/repos/LLK/scratch-vm/events","assignees_url":"https://api.github.com/repos/LLK/scratch-vm/assignees{/user}","branches_url":"https://api.github.com/repos/LLK/scratch-vm/branches{/branch}","tags_url":"https://api.github.com/repos/LLK/scratch-vm/tags","blobs_url":"https://api.github.com/repos/LLK/scratch-vm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/LLK/scratch-vm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/LLK/scratch-vm/git/refs{/sha}","trees_url":"https://api.github.com/repos/LLK/scratch-vm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/LLK/scratch-vm/statuses/{sha}","languages_url":"https://api.github.com/repos/LLK/scratch-vm/languages","stargazers_url":"https://api.github.com/repos/LLK/scratch-vm/stargazers","contributors_url":"https://api.github.com/repos/LLK/scratch-vm/contributors","subscribers_url":"https://api.github.com/repos/LLK/scratch-vm/subscribers","subscription_url":"https://api.github.com/repos/LLK/scratch-vm/subscription","commits_url":"https://api.github.com/repos/LLK/scratch-vm/commits{/sha}","git_commits_url":"https://api.github.com/repos/LLK/scratch-vm/git/commits{/sha}","comments_url":"https://api.github.com/repos/LLK/scratch-vm/comments{/number}","issue_comment_url":"https://api.github.com/repos/LLK/scratch-vm/issues/comments{/number}","contents_url":"https://api.github.com/repos/LLK/scratch-vm/contents/{+path}","compare_url":"https://api.github.com/repos/LLK/scratch-vm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/LLK/scratch-vm/merges","archive_url":"https://api.github.com/repos/LLK/scratch-vm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/LLK/scratch-vm/downloads","issues_url":"https://api.github.com/repos/LLK/scratch-vm/issues{/number}","pulls_url":"https://api.github.com/repos/LLK/scratch-vm/pulls{/number}","milestones_url":"https://api.github.com/repos/LLK/scratch-vm/milestones{/number}","notifications_url":"https://api.github.com/repos/LLK/scratch-vm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/LLK/scratch-vm/labels{/name}","releases_url":"https://api.github.com/repos/LLK/scratch-vm/releases{/id}","deployments_url":"https://api.github.com/repos/LLK/scratch-vm/deployments","created_at":"2016-04-08T17:08:04Z","updated_at":"2016-09-30T05:15:19Z","pushed_at":"2016-10-03T20:39:28Z","git_url":"git://github.com/LLK/scratch-vm.git","ssh_url":"git@github.com:LLK/scratch-vm.git","clone_url":"https://github.com/LLK/scratch-vm.git","svn_url":"https://github.com/LLK/scratch-vm","homepage":"https://scratch.mit.edu/developers","size":2524,"stargazers_count":58,"watchers_count":58,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":26,"mirror_url":null,"open_issues_count":29,"forks":26,"open_issues":29,"watchers":58,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/LLK/scratch-vm/pulls/228"},"html":{"href":"https://github.com/LLK/scratch-vm/pull/228"},"issue":{"href":"https://api.github.com/repos/LLK/scratch-vm/issues/228"},"comments":{"href":"https://api.github.com/repos/LLK/scratch-vm/issues/228/comments"},"review_comments":{"href":"https://api.github.com/repos/LLK/scratch-vm/pulls/228/comments"},"review_comment":{"href":"https://api.github.com/repos/LLK/scratch-vm/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/LLK/scratch-vm/pulls/228/commits"},"statuses":{"href":"https://api.github.com/repos/LLK/scratch-vm/statuses/8ca6944292bd18f2e0ae540e1abb59ca884bf35e"}}}}
{"actor":{"display_login":"tmickel"}}