{"action":"created","comment":{"url":"https://api.github.com/repos/jscs-dev/node-jscs/pulls/comments/43584582","id":43584582,"diff_hunk":"@@ -308,50 +359,67 @@ JsFile.prototype = {\n     /**\n      * Returns the first token for the file.\n      *\n+     * @param {Option} [options]\n+     * @param {Boolean} [options.includeComments=false]\n+     * @param {Boolean} [options.includeWhitespace=false]\n      * @returns {Object}\n      */\n-    getFirstToken: function() {\n-        return this._tokens[0];\n+    getFirstToken: function(options) {\n+        return this._getTokenFromIndex(0, 1, options);\n     },\n \n     /**\n      * Returns the last token for the file.\n      *\n+     * @param {Option} [options]\n+     * @param {Boolean} [options.includeComments=false]\n+     * @param {Boolean} [options.includeWhitespace=false]\n      * @returns {Object}\n      */\n-    getLastToken: function() {\n-        return this._tokens[this._tokens.length - 1];\n+    getLastToken: function(options) {\n+        return this._getTokenFromIndex(this._tokens.length - 1, -1, options);\n     },\n \n     /**\n-     * Returns the first token before the given.\n+     * Returns the first token after the given using direction and specified conditions.\n      *\n-     * @param {Object} token\n+     * @param {Number} index\n+     * @param {Number} direction `1` - forward or `-1` - backwards\n      * @param {Object} [options]\n      * @param {Boolean} [options.includeComments=false]\n+     * @param {Boolean} [options.includeWhitespace=false]\n      * @returns {Object|null}\n      */\n-    getPrevToken: function(token, options) {\n-        var index = token._tokenIndex - 1;\n-        if (index < 0) {\n-            return null;\n-        }\n-\n-        if (options && options.includeComments) {\n-            return this._tokens[index] || null;\n-        }\n+    _getTokenFromIndex: function(index, direction, options) {","path":"lib/js-file.js","position":183,"original_position":183,"commit_id":"cdb10058841df33974a1b8fa1299f47e57555ed3","original_commit_id":"cdb10058841df33974a1b8fa1299f47e57555ed3","user":{"login":"markelog","id":945528,"avatar_url":"https://avatars.githubusercontent.com/u/945528?v=3","gravatar_id":"","url":"https://api.github.com/users/markelog","html_url":"https://github.com/markelog","followers_url":"https://api.github.com/users/markelog/followers","following_url":"https://api.github.com/users/markelog/following{/other_user}","gists_url":"https://api.github.com/users/markelog/gists{/gist_id}","starred_url":"https://api.github.com/users/markelog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markelog/subscriptions","organizations_url":"https://api.github.com/users/markelog/orgs","repos_url":"https://api.github.com/users/markelog/repos","events_url":"https://api.github.com/users/markelog/events{/privacy}","received_events_url":"https://api.github.com/users/markelog/received_events","type":"User","site_admin":false},"body":"Well, we could use keywords, like \"left\", \"right\", but yeah, if we remove it soon, then no big deal, but i always afraid phrase - \"There is nothing more permanent than temporary\"","created_at":"2015-11-01T16:51:42Z","updated_at":"2015-11-01T16:51:42Z","html_url":"https://github.com/jscs-dev/node-jscs/pull/1942#discussion_r43584582","pull_request_url":"https://api.github.com/repos/jscs-dev/node-jscs/pulls/1942","_links":{"self":{"href":"https://api.github.com/repos/jscs-dev/node-jscs/pulls/comments/43584582"},"html":{"href":"https://github.com/jscs-dev/node-jscs/pull/1942#discussion_r43584582"},"pull_request":{"href":"https://api.github.com/repos/jscs-dev/node-jscs/pulls/1942"}}},"pull_request":{"url":"https://api.github.com/repos/jscs-dev/node-jscs/pulls/1942","id":49205112,"html_url":"https://github.com/jscs-dev/node-jscs/pull/1942","diff_url":"https://github.com/jscs-dev/node-jscs/pull/1942.diff","patch_url":"https://github.com/jscs-dev/node-jscs/pull/1942.patch","issue_url":"https://api.github.com/repos/jscs-dev/node-jscs/issues/1942","number":1942,"state":"open","locked":false,"title":"Whitespace token","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":"Implementation of Whitespace-token in JSCS.\r\n\r\nThis is a prerequirement for CST integration.\r\n\r\n/cc @hzoo @markelog ","created_at":"2015-10-29T21:50:45Z","updated_at":"2015-11-01T16:51:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0e87691ec843ab461f8a36b4fd60ab31f2e74604","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/jscs-dev/node-jscs/pulls/1942/commits","review_comments_url":"https://api.github.com/repos/jscs-dev/node-jscs/pulls/1942/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/1942/comments","statuses_url":"https://api.github.com/repos/jscs-dev/node-jscs/statuses/cdb10058841df33974a1b8fa1299f47e57555ed3","head":{"label":"jscs-dev:mdevils/whitespace-token","ref":"mdevils/whitespace-token","sha":"cdb10058841df33974a1b8fa1299f47e57555ed3","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-11-01T16:23:27Z","pushed_at":"2015-10-31T22:53:59Z","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":14314,"stargazers_count":4295,"watchers_count":4295,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":452,"mirror_url":null,"open_issues_count":174,"forks":452,"open_issues":174,"watchers":4295,"default_branch":"master"}},"base":{"label":"jscs-dev:master","ref":"master","sha":"7a85716e1781af1aebc289c732e13ef2fb5bebce","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-11-01T16:23:27Z","pushed_at":"2015-10-31T22:53:59Z","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":14314,"stargazers_count":4295,"watchers_count":4295,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":452,"mirror_url":null,"open_issues_count":174,"forks":452,"open_issues":174,"watchers":4295,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jscs-dev/node-jscs/pulls/1942"},"html":{"href":"https://github.com/jscs-dev/node-jscs/pull/1942"},"issue":{"href":"https://api.github.com/repos/jscs-dev/node-jscs/issues/1942"},"comments":{"href":"https://api.github.com/repos/jscs-dev/node-jscs/issues/1942/comments"},"review_comments":{"href":"https://api.github.com/repos/jscs-dev/node-jscs/pulls/1942/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/1942/commits"},"statuses":{"href":"https://api.github.com/repos/jscs-dev/node-jscs/statuses/cdb10058841df33974a1b8fa1299f47e57555ed3"}}}}