{"action":"created","comment":{"url":"https://api.github.com/repos/sindresorhus/delay/pulls/comments/63323877","id":63323877,"diff_hunk":"@@ -10,25 +10,23 @@ function generate(argIndex) {\n \t\tvar promise = thunk(value);\n \t\tthunk.then = promise.then.bind(promise);\n \t\tthunk.catch = promise.catch.bind(promise);\n-\t\treturn thunk;\n \n-\t\tfunction thunk(result) {\n-\t\t\tif (promise) {\n-\t\t\t\t// Prevent unhandled rejection errors if promise is never used, and only used as a thunk\n-\t\t\t\tpromise.catch(function () {});\n-\t\t\t}\n+\t\t// Prevent unhandled rejection errors if promise is never used, and only used as a thunk\n+\t\tpromise.catch(function () {});\n \n-\t\t\treturn new Promise(function () {\n-\t\t\t\t// resolve / reject\n-\t\t\t\tvar complete = arguments[argIndex];\n+\t\treturn thunk;\n \n-\t\t\t\tsetTimeout(function () {\n-\t\t\t\t\tcomplete(useValue ? value : result);\n-\t\t\t\t}, ms);\n+\t\tfunction thunk(result) {\n+\t\t\treturn new Promise(function (resolve, reject) {\n+\t\t\t\tsetTimeout(\n+\t\t\t\t\twillResolve ? resolve : reject,\n+\t\t\t\t\tms,\n+\t\t\t\t\tuseValue ? value : result","path":"index.js","position":35,"original_position":35,"commit_id":"60f5dd72b1f6fbe5a899466dc8df33a1e399794c","original_commit_id":"60f5dd72b1f6fbe5a899466dc8df33a1e399794c","user":{"login":"jamestalmage","id":4082216,"avatar_url":"https://avatars.githubusercontent.com/u/4082216?v=3","gravatar_id":"","url":"https://api.github.com/users/jamestalmage","html_url":"https://github.com/jamestalmage","followers_url":"https://api.github.com/users/jamestalmage/followers","following_url":"https://api.github.com/users/jamestalmage/following{/other_user}","gists_url":"https://api.github.com/users/jamestalmage/gists{/gist_id}","starred_url":"https://api.github.com/users/jamestalmage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamestalmage/subscriptions","organizations_url":"https://api.github.com/users/jamestalmage/orgs","repos_url":"https://api.github.com/users/jamestalmage/repos","events_url":"https://api.github.com/users/jamestalmage/events{/privacy}","received_events_url":"https://api.github.com/users/jamestalmage/received_events","type":"User","site_admin":false},"body":"Meh. I just checked, this works all the way back to Node 0.10. I thought it was a newer feature than that. I'm good with this.","created_at":"2016-05-16T08:38:25Z","updated_at":"2016-05-16T08:38:25Z","html_url":"https://github.com/sindresorhus/delay/pull/11#discussion_r63323877","pull_request_url":"https://api.github.com/repos/sindresorhus/delay/pulls/11","_links":{"self":{"href":"https://api.github.com/repos/sindresorhus/delay/pulls/comments/63323877"},"html":{"href":"https://github.com/sindresorhus/delay/pull/11#discussion_r63323877"},"pull_request":{"href":"https://api.github.com/repos/sindresorhus/delay/pulls/11"}}},"pull_request":{"url":"https://api.github.com/repos/sindresorhus/delay/pulls/11","id":70162052,"html_url":"https://github.com/sindresorhus/delay/pull/11","diff_url":"https://github.com/sindresorhus/delay/pull/11.diff","patch_url":"https://github.com/sindresorhus/delay/pull/11.patch","issue_url":"https://api.github.com/repos/sindresorhus/delay/issues/11","number":11,"state":"open","locked":false,"title":"Fix tests and make code simpler/clearer","user":{"login":"bfred-it","id":1402241,"avatar_url":"https://avatars.githubusercontent.com/u/1402241?v=3","gravatar_id":"","url":"https://api.github.com/users/bfred-it","html_url":"https://github.com/bfred-it","followers_url":"https://api.github.com/users/bfred-it/followers","following_url":"https://api.github.com/users/bfred-it/following{/other_user}","gists_url":"https://api.github.com/users/bfred-it/gists{/gist_id}","starred_url":"https://api.github.com/users/bfred-it/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bfred-it/subscriptions","organizations_url":"https://api.github.com/users/bfred-it/orgs","repos_url":"https://api.github.com/users/bfred-it/repos","events_url":"https://api.github.com/users/bfred-it/events{/privacy}","received_events_url":"https://api.github.com/users/bfred-it/received_events","type":"User","site_admin":false},"body":"These commits avoid intermediary functions, shorten the code and deobfuscate the resolve/reject part of the code.\r\n\r\nI'm not sure of how you feel about retouching code that works, but I thought I'd make a PR to possibly improve readability of the code. ","created_at":"2016-05-16T07:53:40Z","updated_at":"2016-05-16T08:38:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a8c6575141c1d92dc2e018df2227fbeb37692bf6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/sindresorhus/delay/pulls/11/commits","review_comments_url":"https://api.github.com/repos/sindresorhus/delay/pulls/11/comments","review_comment_url":"https://api.github.com/repos/sindresorhus/delay/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sindresorhus/delay/issues/11/comments","statuses_url":"https://api.github.com/repos/sindresorhus/delay/statuses/60f5dd72b1f6fbe5a899466dc8df33a1e399794c","head":{"label":"bfred-it:simplification","ref":"simplification","sha":"60f5dd72b1f6fbe5a899466dc8df33a1e399794c","user":{"login":"bfred-it","id":1402241,"avatar_url":"https://avatars.githubusercontent.com/u/1402241?v=3","gravatar_id":"","url":"https://api.github.com/users/bfred-it","html_url":"https://github.com/bfred-it","followers_url":"https://api.github.com/users/bfred-it/followers","following_url":"https://api.github.com/users/bfred-it/following{/other_user}","gists_url":"https://api.github.com/users/bfred-it/gists{/gist_id}","starred_url":"https://api.github.com/users/bfred-it/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bfred-it/subscriptions","organizations_url":"https://api.github.com/users/bfred-it/orgs","repos_url":"https://api.github.com/users/bfred-it/repos","events_url":"https://api.github.com/users/bfred-it/events{/privacy}","received_events_url":"https://api.github.com/users/bfred-it/received_events","type":"User","site_admin":false},"repo":{"id":58912188,"name":"delay","full_name":"bfred-it/delay","owner":{"login":"bfred-it","id":1402241,"avatar_url":"https://avatars.githubusercontent.com/u/1402241?v=3","gravatar_id":"","url":"https://api.github.com/users/bfred-it","html_url":"https://github.com/bfred-it","followers_url":"https://api.github.com/users/bfred-it/followers","following_url":"https://api.github.com/users/bfred-it/following{/other_user}","gists_url":"https://api.github.com/users/bfred-it/gists{/gist_id}","starred_url":"https://api.github.com/users/bfred-it/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bfred-it/subscriptions","organizations_url":"https://api.github.com/users/bfred-it/orgs","repos_url":"https://api.github.com/users/bfred-it/repos","events_url":"https://api.github.com/users/bfred-it/events{/privacy}","received_events_url":"https://api.github.com/users/bfred-it/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bfred-it/delay","description":"Delay a promise a specified amount of time","fork":true,"url":"https://api.github.com/repos/bfred-it/delay","forks_url":"https://api.github.com/repos/bfred-it/delay/forks","keys_url":"https://api.github.com/repos/bfred-it/delay/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bfred-it/delay/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bfred-it/delay/teams","hooks_url":"https://api.github.com/repos/bfred-it/delay/hooks","issue_events_url":"https://api.github.com/repos/bfred-it/delay/issues/events{/number}","events_url":"https://api.github.com/repos/bfred-it/delay/events","assignees_url":"https://api.github.com/repos/bfred-it/delay/assignees{/user}","branches_url":"https://api.github.com/repos/bfred-it/delay/branches{/branch}","tags_url":"https://api.github.com/repos/bfred-it/delay/tags","blobs_url":"https://api.github.com/repos/bfred-it/delay/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bfred-it/delay/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bfred-it/delay/git/refs{/sha}","trees_url":"https://api.github.com/repos/bfred-it/delay/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bfred-it/delay/statuses/{sha}","languages_url":"https://api.github.com/repos/bfred-it/delay/languages","stargazers_url":"https://api.github.com/repos/bfred-it/delay/stargazers","contributors_url":"https://api.github.com/repos/bfred-it/delay/contributors","subscribers_url":"https://api.github.com/repos/bfred-it/delay/subscribers","subscription_url":"https://api.github.com/repos/bfred-it/delay/subscription","commits_url":"https://api.github.com/repos/bfred-it/delay/commits{/sha}","git_commits_url":"https://api.github.com/repos/bfred-it/delay/git/commits{/sha}","comments_url":"https://api.github.com/repos/bfred-it/delay/comments{/number}","issue_comment_url":"https://api.github.com/repos/bfred-it/delay/issues/comments{/number}","contents_url":"https://api.github.com/repos/bfred-it/delay/contents/{+path}","compare_url":"https://api.github.com/repos/bfred-it/delay/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bfred-it/delay/merges","archive_url":"https://api.github.com/repos/bfred-it/delay/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bfred-it/delay/downloads","issues_url":"https://api.github.com/repos/bfred-it/delay/issues{/number}","pulls_url":"https://api.github.com/repos/bfred-it/delay/pulls{/number}","milestones_url":"https://api.github.com/repos/bfred-it/delay/milestones{/number}","notifications_url":"https://api.github.com/repos/bfred-it/delay/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bfred-it/delay/labels{/name}","releases_url":"https://api.github.com/repos/bfred-it/delay/releases{/id}","deployments_url":"https://api.github.com/repos/bfred-it/delay/deployments","created_at":"2016-05-16T07:24:51Z","updated_at":"2016-05-16T07:24:52Z","pushed_at":"2016-05-16T07:48:11Z","git_url":"git://github.com/bfred-it/delay.git","ssh_url":"git@github.com:bfred-it/delay.git","clone_url":"https://github.com/bfred-it/delay.git","svn_url":"https://github.com/bfred-it/delay","homepage":null,"size":12,"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":"master"}},"base":{"label":"sindresorhus:master","ref":"master","sha":"aab8a40c2eb199e8f772f8f20c367ac1cca8a435","user":{"login":"sindresorhus","id":170270,"avatar_url":"https://avatars.githubusercontent.com/u/170270?v=3","gravatar_id":"","url":"https://api.github.com/users/sindresorhus","html_url":"https://github.com/sindresorhus","followers_url":"https://api.github.com/users/sindresorhus/followers","following_url":"https://api.github.com/users/sindresorhus/following{/other_user}","gists_url":"https://api.github.com/users/sindresorhus/gists{/gist_id}","starred_url":"https://api.github.com/users/sindresorhus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sindresorhus/subscriptions","organizations_url":"https://api.github.com/users/sindresorhus/orgs","repos_url":"https://api.github.com/users/sindresorhus/repos","events_url":"https://api.github.com/users/sindresorhus/events{/privacy}","received_events_url":"https://api.github.com/users/sindresorhus/received_events","type":"User","site_admin":false},"repo":{"id":46072466,"name":"delay","full_name":"sindresorhus/delay","owner":{"login":"sindresorhus","id":170270,"avatar_url":"https://avatars.githubusercontent.com/u/170270?v=3","gravatar_id":"","url":"https://api.github.com/users/sindresorhus","html_url":"https://github.com/sindresorhus","followers_url":"https://api.github.com/users/sindresorhus/followers","following_url":"https://api.github.com/users/sindresorhus/following{/other_user}","gists_url":"https://api.github.com/users/sindresorhus/gists{/gist_id}","starred_url":"https://api.github.com/users/sindresorhus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sindresorhus/subscriptions","organizations_url":"https://api.github.com/users/sindresorhus/orgs","repos_url":"https://api.github.com/users/sindresorhus/repos","events_url":"https://api.github.com/users/sindresorhus/events{/privacy}","received_events_url":"https://api.github.com/users/sindresorhus/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sindresorhus/delay","description":"Delay a promise a specified amount of time","fork":false,"url":"https://api.github.com/repos/sindresorhus/delay","forks_url":"https://api.github.com/repos/sindresorhus/delay/forks","keys_url":"https://api.github.com/repos/sindresorhus/delay/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sindresorhus/delay/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sindresorhus/delay/teams","hooks_url":"https://api.github.com/repos/sindresorhus/delay/hooks","issue_events_url":"https://api.github.com/repos/sindresorhus/delay/issues/events{/number}","events_url":"https://api.github.com/repos/sindresorhus/delay/events","assignees_url":"https://api.github.com/repos/sindresorhus/delay/assignees{/user}","branches_url":"https://api.github.com/repos/sindresorhus/delay/branches{/branch}","tags_url":"https://api.github.com/repos/sindresorhus/delay/tags","blobs_url":"https://api.github.com/repos/sindresorhus/delay/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sindresorhus/delay/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sindresorhus/delay/git/refs{/sha}","trees_url":"https://api.github.com/repos/sindresorhus/delay/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sindresorhus/delay/statuses/{sha}","languages_url":"https://api.github.com/repos/sindresorhus/delay/languages","stargazers_url":"https://api.github.com/repos/sindresorhus/delay/stargazers","contributors_url":"https://api.github.com/repos/sindresorhus/delay/contributors","subscribers_url":"https://api.github.com/repos/sindresorhus/delay/subscribers","subscription_url":"https://api.github.com/repos/sindresorhus/delay/subscription","commits_url":"https://api.github.com/repos/sindresorhus/delay/commits{/sha}","git_commits_url":"https://api.github.com/repos/sindresorhus/delay/git/commits{/sha}","comments_url":"https://api.github.com/repos/sindresorhus/delay/comments{/number}","issue_comment_url":"https://api.github.com/repos/sindresorhus/delay/issues/comments{/number}","contents_url":"https://api.github.com/repos/sindresorhus/delay/contents/{+path}","compare_url":"https://api.github.com/repos/sindresorhus/delay/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sindresorhus/delay/merges","archive_url":"https://api.github.com/repos/sindresorhus/delay/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sindresorhus/delay/downloads","issues_url":"https://api.github.com/repos/sindresorhus/delay/issues{/number}","pulls_url":"https://api.github.com/repos/sindresorhus/delay/pulls{/number}","milestones_url":"https://api.github.com/repos/sindresorhus/delay/milestones{/number}","notifications_url":"https://api.github.com/repos/sindresorhus/delay/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sindresorhus/delay/labels{/name}","releases_url":"https://api.github.com/repos/sindresorhus/delay/releases{/id}","deployments_url":"https://api.github.com/repos/sindresorhus/delay/deployments","created_at":"2015-11-12T18:31:41Z","updated_at":"2016-05-16T07:03:09Z","pushed_at":"2016-05-16T07:53:40Z","git_url":"git://github.com/sindresorhus/delay.git","ssh_url":"git@github.com:sindresorhus/delay.git","clone_url":"https://github.com/sindresorhus/delay.git","svn_url":"https://github.com/sindresorhus/delay","homepage":null,"size":16,"stargazers_count":84,"watchers_count":84,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":1,"forks":4,"open_issues":1,"watchers":84,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sindresorhus/delay/pulls/11"},"html":{"href":"https://github.com/sindresorhus/delay/pull/11"},"issue":{"href":"https://api.github.com/repos/sindresorhus/delay/issues/11"},"comments":{"href":"https://api.github.com/repos/sindresorhus/delay/issues/11/comments"},"review_comments":{"href":"https://api.github.com/repos/sindresorhus/delay/pulls/11/comments"},"review_comment":{"href":"https://api.github.com/repos/sindresorhus/delay/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sindresorhus/delay/pulls/11/commits"},"statuses":{"href":"https://api.github.com/repos/sindresorhus/delay/statuses/60f5dd72b1f6fbe5a899466dc8df33a1e399794c"}}}}