{"action":"created","comment":{"url":"https://api.github.com/repos/jscs-dev/node-jscs/pulls/comments/24448893","id":24448893,"diff_hunk":"@@ -244,26 +185,60 @@ JsFile.prototype = {\n     getLastNodeToken: function(node) {\n         return this.getTokenByRangeEnd(node.range[1]);\n     },\n+\n     /**\n      * Returns the first token before the given.\n      *\n      * @param {Object} token\n+     * @param {Object} [options]\n+     * @param {Boolean} [options.includeComments=false]\n      * @returns {Object|undefined}\n      */\n-    getPrevToken: function(token) {\n+    getPrevToken: function(token, options) {\n         var index = token._tokenIndex - 1;\n-        return index >= 0 ? this._tree.tokens[index] : undefined;\n+        if (index < 0) {\n+            return undefined;\n+        }\n+\n+        if (options && options.includeComments) {\n+            return this._tokens[index];\n+        }\n+\n+        do {\n+            if (!this._tokens[index].isComment) {\n+                return this._tokens[index];\n+            }\n+        } while (--index >= 0);\n+\n+        return undefined;\n     },\n+\n     /**\n      * Returns the first token after the given.\n      *\n      * @param {Object} token\n+     * @param {Object} [options]\n+     * @param {Boolean} [options.includeComments=false]\n      * @returns {Object|undefined}\n      */\n-    getNextToken: function(token) {\n+    getNextToken: function(token, options) {\n         var index = token._tokenIndex + 1;\n-        return index < this._tree.tokens.length ? this._tree.tokens[index] : undefined;\n+\n+        if (index >= this._tokens.length) {\n+            return undefined;\n+        }\n+\n+        if (options && options.includeComments) {\n+            return this._tokens[index];\n+        }\n+\n+        do {\n+            if (!this._tokens[index].isComment) {\n+                return this._tokens[index];\n+            }\n+        } while (++index < this._tokens.length);","path":"lib/js-file.js","position":263,"original_position":263,"commit_id":"13a9a8a1f91ade6a8e5c1a52e21b2627caa8e527","original_commit_id":"13a9a8a1f91ade6a8e5c1a52e21b2627caa8e527","user":{"login":"mikesherov","id":364532,"avatar_url":"https://avatars.githubusercontent.com/u/364532?v=3","gravatar_id":"","url":"https://api.github.com/users/mikesherov","html_url":"https://github.com/mikesherov","followers_url":"https://api.github.com/users/mikesherov/followers","following_url":"https://api.github.com/users/mikesherov/following{/other_user}","gists_url":"https://api.github.com/users/mikesherov/gists{/gist_id}","starred_url":"https://api.github.com/users/mikesherov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikesherov/subscriptions","organizations_url":"https://api.github.com/users/mikesherov/orgs","repos_url":"https://api.github.com/users/mikesherov/repos","events_url":"https://api.github.com/users/mikesherov/events{/privacy}","received_events_url":"https://api.github.com/users/mikesherov/received_events","type":"User","site_admin":false},"body":"Let's move this discussion to a new issue.","created_at":"2015-02-10T20:46:55Z","updated_at":"2015-02-10T20:46:55Z","html_url":"https://github.com/jscs-dev/node-jscs/pull/1012#discussion_r24448893","pull_request_url":"https://api.github.com/repos/jscs-dev/node-jscs/pulls/1012","_links":{"self":{"href":"https://api.github.com/repos/jscs-dev/node-jscs/pulls/comments/24448893"},"html":{"href":"https://github.com/jscs-dev/node-jscs/pull/1012#discussion_r24448893"},"pull_request":{"href":"https://api.github.com/repos/jscs-dev/node-jscs/pulls/1012"}}},"pull_request":{"url":"https://api.github.com/repos/jscs-dev/node-jscs/pulls/1012","id":28865122,"html_url":"https://github.com/jscs-dev/node-jscs/pull/1012","diff_url":"https://github.com/jscs-dev/node-jscs/pull/1012.diff","patch_url":"https://github.com/jscs-dev/node-jscs/pull/1012.patch","issue_url":"https://api.github.com/repos/jscs-dev/node-jscs/issues/1012","number":1012,"state":"open","locked":false,"title":"Autofixing: token data","user":{"login":"mdevils","id":176898,"avatar_url":"https://avatars.githubusercontent.com/u/176898?v=3","gravatar_id":"","url":"https://api.github.com/users/mdevils","html_url":"https://github.com/mdevils","followers_url":"https://api.github.com/users/mdevils/followers","following_url":"https://api.github.com/users/mdevils/following{/other_user}","gists_url":"https://api.github.com/users/mdevils/gists{/gist_id}","starred_url":"https://api.github.com/users/mdevils/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mdevils/subscriptions","organizations_url":"https://api.github.com/users/mdevils/orgs","repos_url":"https://api.github.com/users/mdevils/repos","events_url":"https://api.github.com/users/mdevils/events{/privacy}","received_events_url":"https://api.github.com/users/mdevils/received_events","type":"User","site_admin":false},"body":"**Work in Progress**\r\n\r\nGetting ready for JS-code reassembly.\r\n\r\nIn this commit I:\r\n* Merged code tokens with comment tokens.\r\n* Prepared tokens for future reassembling into JS-source.\r\n* Applied whitespace info to the tokens.\r\n* Refactored `JsFile` class to increase simplicity.\r\n\r\n/cc @mikesherov @markelog @mrjoelkemp @zxqfox ","created_at":"2015-02-07T14:57:27Z","updated_at":"2015-02-10T20:46:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d83fd18a1384594fd2d7bf78fa92d1eff79ff305","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/jscs-dev/node-jscs/pulls/1012/commits","review_comments_url":"https://api.github.com/repos/jscs-dev/node-jscs/pulls/1012/comments","review_comment_url":"https://api.github.com/repos/jscs-dev/node-jscs/pulls/comments/{number}","comments_url":"https://api.github.com/repos/jscs-dev/node-jscs/issues/1012/comments","statuses_url":"https://api.github.com/repos/jscs-dev/node-jscs/statuses/13a9a8a1f91ade6a8e5c1a52e21b2627caa8e527","head":{"label":"jscs-dev:mdevils.autofixing-token-data","ref":"mdevils.autofixing-token-data","sha":"13a9a8a1f91ade6a8e5c1a52e21b2627caa8e527","user":{"login":"jscs-dev","id":8018201,"avatar_url":"https://avatars.githubusercontent.com/u/8018201?v=3","gravatar_id":"","url":"https://api.github.com/users/jscs-dev","html_url":"https://github.com/jscs-dev","followers_url":"https://api.github.com/users/jscs-dev/followers","following_url":"https://api.github.com/users/jscs-dev/following{/other_user}","gists_url":"https://api.github.com/users/jscs-dev/gists{/gist_id}","starred_url":"https://api.github.com/users/jscs-dev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jscs-dev/subscriptions","organizations_url":"https://api.github.com/users/jscs-dev/orgs","repos_url":"https://api.github.com/users/jscs-dev/repos","events_url":"https://api.github.com/users/jscs-dev/events{/privacy}","received_events_url":"https://api.github.com/users/jscs-dev/received_events","type":"Organization","site_admin":false},"repo":{"id":10697582,"name":"node-jscs","full_name":"jscs-dev/node-jscs","owner":{"login":"jscs-dev","id":8018201,"avatar_url":"https://avatars.githubusercontent.com/u/8018201?v=3","gravatar_id":"","url":"https://api.github.com/users/jscs-dev","html_url":"https://github.com/jscs-dev","followers_url":"https://api.github.com/users/jscs-dev/followers","following_url":"https://api.github.com/users/jscs-dev/following{/other_user}","gists_url":"https://api.github.com/users/jscs-dev/gists{/gist_id}","starred_url":"https://api.github.com/users/jscs-dev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jscs-dev/subscriptions","organizations_url":"https://api.github.com/users/jscs-dev/orgs","repos_url":"https://api.github.com/users/jscs-dev/repos","events_url":"https://api.github.com/users/jscs-dev/events{/privacy}","received_events_url":"https://api.github.com/users/jscs-dev/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/jscs-dev/node-jscs","description":"JavaScript Code Style checker","fork":false,"url":"https://api.github.com/repos/jscs-dev/node-jscs","forks_url":"https://api.github.com/repos/jscs-dev/node-jscs/forks","keys_url":"https://api.github.com/repos/jscs-dev/node-jscs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jscs-dev/node-jscs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jscs-dev/node-jscs/teams","hooks_url":"https://api.github.com/repos/jscs-dev/node-jscs/hooks","issue_events_url":"https://api.github.com/repos/jscs-dev/node-jscs/issues/events{/number}","events_url":"https://api.github.com/repos/jscs-dev/node-jscs/events","assignees_url":"https://api.github.com/repos/jscs-dev/node-jscs/assignees{/user}","branches_url":"https://api.github.com/repos/jscs-dev/node-jscs/branches{/branch}","tags_url":"https://api.github.com/repos/jscs-dev/node-jscs/tags","blobs_url":"https://api.github.com/repos/jscs-dev/node-jscs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jscs-dev/node-jscs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jscs-dev/node-jscs/git/refs{/sha}","trees_url":"https://api.github.com/repos/jscs-dev/node-jscs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jscs-dev/node-jscs/statuses/{sha}","languages_url":"https://api.github.com/repos/jscs-dev/node-jscs/languages","stargazers_url":"https://api.github.com/repos/jscs-dev/node-jscs/stargazers","contributors_url":"https://api.github.com/repos/jscs-dev/node-jscs/contributors","subscribers_url":"https://api.github.com/repos/jscs-dev/node-jscs/subscribers","subscription_url":"https://api.github.com/repos/jscs-dev/node-jscs/subscription","commits_url":"https://api.github.com/repos/jscs-dev/node-jscs/commits{/sha}","git_commits_url":"https://api.github.com/repos/jscs-dev/node-jscs/git/commits{/sha}","comments_url":"https://api.github.com/repos/jscs-dev/node-jscs/comments{/number}","issue_comment_url":"https://api.github.com/repos/jscs-dev/node-jscs/issues/comments/{number}","contents_url":"https://api.github.com/repos/jscs-dev/node-jscs/contents/{+path}","compare_url":"https://api.github.com/repos/jscs-dev/node-jscs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jscs-dev/node-jscs/merges","archive_url":"https://api.github.com/repos/jscs-dev/node-jscs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jscs-dev/node-jscs/downloads","issues_url":"https://api.github.com/repos/jscs-dev/node-jscs/issues{/number}","pulls_url":"https://api.github.com/repos/jscs-dev/node-jscs/pulls{/number}","milestones_url":"https://api.github.com/repos/jscs-dev/node-jscs/milestones{/number}","notifications_url":"https://api.github.com/repos/jscs-dev/node-jscs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jscs-dev/node-jscs/labels{/name}","releases_url":"https://api.github.com/repos/jscs-dev/node-jscs/releases{/id}","created_at":"2013-06-14T20:53:48Z","updated_at":"2015-02-10T17:15:50Z","pushed_at":"2015-02-10T15:26:41Z","git_url":"git://github.com/jscs-dev/node-jscs.git","ssh_url":"git@github.com:jscs-dev/node-jscs.git","clone_url":"https://github.com/jscs-dev/node-jscs.git","svn_url":"https://github.com/jscs-dev/node-jscs","homepage":"http://jscs.info/","size":8841,"stargazers_count":2492,"watchers_count":2492,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":249,"mirror_url":null,"open_issues_count":107,"forks":249,"open_issues":107,"watchers":2492,"default_branch":"master"}},"base":{"label":"jscs-dev:master","ref":"master","sha":"e14988d51542ca9f27bd505abf6ee57636bebe18","user":{"login":"jscs-dev","id":8018201,"avatar_url":"https://avatars.githubusercontent.com/u/8018201?v=3","gravatar_id":"","url":"https://api.github.com/users/jscs-dev","html_url":"https://github.com/jscs-dev","followers_url":"https://api.github.com/users/jscs-dev/followers","following_url":"https://api.github.com/users/jscs-dev/following{/other_user}","gists_url":"https://api.github.com/users/jscs-dev/gists{/gist_id}","starred_url":"https://api.github.com/users/jscs-dev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jscs-dev/subscriptions","organizations_url":"https://api.github.com/users/jscs-dev/orgs","repos_url":"https://api.github.com/users/jscs-dev/repos","events_url":"https://api.github.com/users/jscs-dev/events{/privacy}","received_events_url":"https://api.github.com/users/jscs-dev/received_events","type":"Organization","site_admin":false},"repo":{"id":10697582,"name":"node-jscs","full_name":"jscs-dev/node-jscs","owner":{"login":"jscs-dev","id":8018201,"avatar_url":"https://avatars.githubusercontent.com/u/8018201?v=3","gravatar_id":"","url":"https://api.github.com/users/jscs-dev","html_url":"https://github.com/jscs-dev","followers_url":"https://api.github.com/users/jscs-dev/followers","following_url":"https://api.github.com/users/jscs-dev/following{/other_user}","gists_url":"https://api.github.com/users/jscs-dev/gists{/gist_id}","starred_url":"https://api.github.com/users/jscs-dev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jscs-dev/subscriptions","organizations_url":"https://api.github.com/users/jscs-dev/orgs","repos_url":"https://api.github.com/users/jscs-dev/repos","events_url":"https://api.github.com/users/jscs-dev/events{/privacy}","received_events_url":"https://api.github.com/users/jscs-dev/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/jscs-dev/node-jscs","description":"JavaScript Code Style checker","fork":false,"url":"https://api.github.com/repos/jscs-dev/node-jscs","forks_url":"https://api.github.com/repos/jscs-dev/node-jscs/forks","keys_url":"https://api.github.com/repos/jscs-dev/node-jscs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jscs-dev/node-jscs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jscs-dev/node-jscs/teams","hooks_url":"https://api.github.com/repos/jscs-dev/node-jscs/hooks","issue_events_url":"https://api.github.com/repos/jscs-dev/node-jscs/issues/events{/number}","events_url":"https://api.github.com/repos/jscs-dev/node-jscs/events","assignees_url":"https://api.github.com/repos/jscs-dev/node-jscs/assignees{/user}","branches_url":"https://api.github.com/repos/jscs-dev/node-jscs/branches{/branch}","tags_url":"https://api.github.com/repos/jscs-dev/node-jscs/tags","blobs_url":"https://api.github.com/repos/jscs-dev/node-jscs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jscs-dev/node-jscs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jscs-dev/node-jscs/git/refs{/sha}","trees_url":"https://api.github.com/repos/jscs-dev/node-jscs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jscs-dev/node-jscs/statuses/{sha}","languages_url":"https://api.github.com/repos/jscs-dev/node-jscs/languages","stargazers_url":"https://api.github.com/repos/jscs-dev/node-jscs/stargazers","contributors_url":"https://api.github.com/repos/jscs-dev/node-jscs/contributors","subscribers_url":"https://api.github.com/repos/jscs-dev/node-jscs/subscribers","subscription_url":"https://api.github.com/repos/jscs-dev/node-jscs/subscription","commits_url":"https://api.github.com/repos/jscs-dev/node-jscs/commits{/sha}","git_commits_url":"https://api.github.com/repos/jscs-dev/node-jscs/git/commits{/sha}","comments_url":"https://api.github.com/repos/jscs-dev/node-jscs/comments{/number}","issue_comment_url":"https://api.github.com/repos/jscs-dev/node-jscs/issues/comments/{number}","contents_url":"https://api.github.com/repos/jscs-dev/node-jscs/contents/{+path}","compare_url":"https://api.github.com/repos/jscs-dev/node-jscs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jscs-dev/node-jscs/merges","archive_url":"https://api.github.com/repos/jscs-dev/node-jscs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jscs-dev/node-jscs/downloads","issues_url":"https://api.github.com/repos/jscs-dev/node-jscs/issues{/number}","pulls_url":"https://api.github.com/repos/jscs-dev/node-jscs/pulls{/number}","milestones_url":"https://api.github.com/repos/jscs-dev/node-jscs/milestones{/number}","notifications_url":"https://api.github.com/repos/jscs-dev/node-jscs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jscs-dev/node-jscs/labels{/name}","releases_url":"https://api.github.com/repos/jscs-dev/node-jscs/releases{/id}","created_at":"2013-06-14T20:53:48Z","updated_at":"2015-02-10T17:15:50Z","pushed_at":"2015-02-10T15:26:41Z","git_url":"git://github.com/jscs-dev/node-jscs.git","ssh_url":"git@github.com:jscs-dev/node-jscs.git","clone_url":"https://github.com/jscs-dev/node-jscs.git","svn_url":"https://github.com/jscs-dev/node-jscs","homepage":"http://jscs.info/","size":8841,"stargazers_count":2492,"watchers_count":2492,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":249,"mirror_url":null,"open_issues_count":107,"forks":249,"open_issues":107,"watchers":2492,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jscs-dev/node-jscs/pulls/1012"},"html":{"href":"https://github.com/jscs-dev/node-jscs/pull/1012"},"issue":{"href":"https://api.github.com/repos/jscs-dev/node-jscs/issues/1012"},"comments":{"href":"https://api.github.com/repos/jscs-dev/node-jscs/issues/1012/comments"},"review_comments":{"href":"https://api.github.com/repos/jscs-dev/node-jscs/pulls/1012/comments"},"review_comment":{"href":"https://api.github.com/repos/jscs-dev/node-jscs/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/jscs-dev/node-jscs/pulls/1012/commits"},"statuses":{"href":"https://api.github.com/repos/jscs-dev/node-jscs/statuses/13a9a8a1f91ade6a8e5c1a52e21b2627caa8e527"}}}}