{"action":"created","comment":{"url":"https://api.github.com/repos/beautify-web/js-beautify/pulls/comments/35029191","id":35029191,"diff_hunk":"@@ -1115,11 +1150,87 @@\n                 flags.in_case = false;\n                 return;\n             }\n+            \n+            var space_before = true;\n+            var space_after = true;\n+            var in_ternary = false;\n+                \n+            if (current_token.text === ':') {\n+                if (flags.ternary_depth === 0) {\n+                    // Colon is invalid javascript outside of ternary and object, but do our best to guess what was meant.\n+                    space_before = false;\n+                } else {\n+                    flags.ternary_depth -= 1;\n+                    in_ternary = true;\n+                }\n+            } else if (current_token.text === '?') {\n+                flags.ternary_depth += 1;\n+            }\n+            \n+            // let's handle the operator_position option prior to any conflicting logic\n+            if (typeof opt.operator_position !== 'undefined' && in_array(current_token.text, OP_POSITION_OPERATORS)) {","path":"js/lib/beautify.js","position":87,"original_position":87,"commit_id":"6503d3a1645f4d168b08796f3dc7b9660aabadee","original_commit_id":"6503d3a1645f4d168b08796f3dc7b9660aabadee","user":{"login":"bitwiseman","id":1958953,"avatar_url":"https://avatars.githubusercontent.com/u/1958953?v=3","gravatar_id":"","url":"https://api.github.com/users/bitwiseman","html_url":"https://github.com/bitwiseman","followers_url":"https://api.github.com/users/bitwiseman/followers","following_url":"https://api.github.com/users/bitwiseman/following{/other_user}","gists_url":"https://api.github.com/users/bitwiseman/gists{/gist_id}","starred_url":"https://api.github.com/users/bitwiseman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bitwiseman/subscriptions","organizations_url":"https://api.github.com/users/bitwiseman/orgs","repos_url":"https://api.github.com/users/bitwiseman/repos","events_url":"https://api.github.com/users/bitwiseman/events{/privacy}","received_events_url":"https://api.github.com/users/bitwiseman/received_events","type":"User","site_admin":false},"body":"Handling the defaulting in the opt setting above means you don't have to check for undefined here. ","created_at":"2015-07-20T18:47:29Z","updated_at":"2015-07-20T18:47:29Z","html_url":"https://github.com/beautify-web/js-beautify/pull/735#discussion_r35029191","pull_request_url":"https://api.github.com/repos/beautify-web/js-beautify/pulls/735","_links":{"self":{"href":"https://api.github.com/repos/beautify-web/js-beautify/pulls/comments/35029191"},"html":{"href":"https://github.com/beautify-web/js-beautify/pull/735#discussion_r35029191"},"pull_request":{"href":"https://api.github.com/repos/beautify-web/js-beautify/pulls/735"}}},"pull_request":{"url":"https://api.github.com/repos/beautify-web/js-beautify/pulls/735","id":40096992,"html_url":"https://github.com/beautify-web/js-beautify/pull/735","diff_url":"https://github.com/beautify-web/js-beautify/pull/735.diff","patch_url":"https://github.com/beautify-web/js-beautify/pull/735.patch","issue_url":"https://api.github.com/repos/beautify-web/js-beautify/issues/735","number":735,"state":"open","locked":false,"title":"first draft of operator_position functionality","user":{"login":"olsonpm","id":5957709,"avatar_url":"https://avatars.githubusercontent.com/u/5957709?v=3","gravatar_id":"","url":"https://api.github.com/users/olsonpm","html_url":"https://github.com/olsonpm","followers_url":"https://api.github.com/users/olsonpm/followers","following_url":"https://api.github.com/users/olsonpm/following{/other_user}","gists_url":"https://api.github.com/users/olsonpm/gists{/gist_id}","starred_url":"https://api.github.com/users/olsonpm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/olsonpm/subscriptions","organizations_url":"https://api.github.com/users/olsonpm/orgs","repos_url":"https://api.github.com/users/olsonpm/repos","events_url":"https://api.github.com/users/olsonpm/events{/privacy}","received_events_url":"https://api.github.com/users/olsonpm/received_events","type":"User","site_admin":false},"body":" - Added verification of operator_position option.  Throws error if\r\n    invalid.\r\n - Possible operator_position options are:\r\n    1) undefined (use default behavior)\r\n    2) 'before_newline'\r\n    3) 'after_newline'\r\n    4) 'preserve_newline'\r\n    5) 'remove_newline'\r\n - Moved some code around in handle_operator in order to separate\r\n    conflicting logic when handling operators.\r\n - Modified allow_wrap_or_preserved_newline to handle operator\r\n    preserved newlines as well.\r\n - Fixed a few boolean variable assignments within if statements.\r\n    Though not always the case, the expression within the if can\r\n    be assigned directly to the variable\r\n - Added -> built tests\r\n - Within the tests, added an 'inputlib.js' file which holds common\r\n    input arrays.  This was necessary due to the matrices not working\r\n    cleanly with default behavior.\r\n - It is worth noting that although the python test file was modified,\r\n    this is a result of the built test and not actually providing\r\n    a python port for this option (yet).","created_at":"2015-07-16T06:00:09Z","updated_at":"2015-07-20T18:47:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bd230b83e623f080f63b13abed5d794212b8a419","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/beautify-web/js-beautify/pulls/735/commits","review_comments_url":"https://api.github.com/repos/beautify-web/js-beautify/pulls/735/comments","review_comment_url":"https://api.github.com/repos/beautify-web/js-beautify/pulls/comments{/number}","comments_url":"https://api.github.com/repos/beautify-web/js-beautify/issues/735/comments","statuses_url":"https://api.github.com/repos/beautify-web/js-beautify/statuses/6503d3a1645f4d168b08796f3dc7b9660aabadee","head":{"label":"olsonpm:add-operator-position","ref":"add-operator-position","sha":"6503d3a1645f4d168b08796f3dc7b9660aabadee","user":{"login":"olsonpm","id":5957709,"avatar_url":"https://avatars.githubusercontent.com/u/5957709?v=3","gravatar_id":"","url":"https://api.github.com/users/olsonpm","html_url":"https://github.com/olsonpm","followers_url":"https://api.github.com/users/olsonpm/followers","following_url":"https://api.github.com/users/olsonpm/following{/other_user}","gists_url":"https://api.github.com/users/olsonpm/gists{/gist_id}","starred_url":"https://api.github.com/users/olsonpm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/olsonpm/subscriptions","organizations_url":"https://api.github.com/users/olsonpm/orgs","repos_url":"https://api.github.com/users/olsonpm/repos","events_url":"https://api.github.com/users/olsonpm/events{/privacy}","received_events_url":"https://api.github.com/users/olsonpm/received_events","type":"User","site_admin":false},"repo":{"id":36640195,"name":"js-beautify","full_name":"olsonpm/js-beautify","owner":{"login":"olsonpm","id":5957709,"avatar_url":"https://avatars.githubusercontent.com/u/5957709?v=3","gravatar_id":"","url":"https://api.github.com/users/olsonpm","html_url":"https://github.com/olsonpm","followers_url":"https://api.github.com/users/olsonpm/followers","following_url":"https://api.github.com/users/olsonpm/following{/other_user}","gists_url":"https://api.github.com/users/olsonpm/gists{/gist_id}","starred_url":"https://api.github.com/users/olsonpm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/olsonpm/subscriptions","organizations_url":"https://api.github.com/users/olsonpm/orgs","repos_url":"https://api.github.com/users/olsonpm/repos","events_url":"https://api.github.com/users/olsonpm/events{/privacy}","received_events_url":"https://api.github.com/users/olsonpm/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/olsonpm/js-beautify","description":"Beautifier for javascript","fork":true,"url":"https://api.github.com/repos/olsonpm/js-beautify","forks_url":"https://api.github.com/repos/olsonpm/js-beautify/forks","keys_url":"https://api.github.com/repos/olsonpm/js-beautify/keys{/key_id}","collaborators_url":"https://api.github.com/repos/olsonpm/js-beautify/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/olsonpm/js-beautify/teams","hooks_url":"https://api.github.com/repos/olsonpm/js-beautify/hooks","issue_events_url":"https://api.github.com/repos/olsonpm/js-beautify/issues/events{/number}","events_url":"https://api.github.com/repos/olsonpm/js-beautify/events","assignees_url":"https://api.github.com/repos/olsonpm/js-beautify/assignees{/user}","branches_url":"https://api.github.com/repos/olsonpm/js-beautify/branches{/branch}","tags_url":"https://api.github.com/repos/olsonpm/js-beautify/tags","blobs_url":"https://api.github.com/repos/olsonpm/js-beautify/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/olsonpm/js-beautify/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/olsonpm/js-beautify/git/refs{/sha}","trees_url":"https://api.github.com/repos/olsonpm/js-beautify/git/trees{/sha}","statuses_url":"https://api.github.com/repos/olsonpm/js-beautify/statuses/{sha}","languages_url":"https://api.github.com/repos/olsonpm/js-beautify/languages","stargazers_url":"https://api.github.com/repos/olsonpm/js-beautify/stargazers","contributors_url":"https://api.github.com/repos/olsonpm/js-beautify/contributors","subscribers_url":"https://api.github.com/repos/olsonpm/js-beautify/subscribers","subscription_url":"https://api.github.com/repos/olsonpm/js-beautify/subscription","commits_url":"https://api.github.com/repos/olsonpm/js-beautify/commits{/sha}","git_commits_url":"https://api.github.com/repos/olsonpm/js-beautify/git/commits{/sha}","comments_url":"https://api.github.com/repos/olsonpm/js-beautify/comments{/number}","issue_comment_url":"https://api.github.com/repos/olsonpm/js-beautify/issues/comments{/number}","contents_url":"https://api.github.com/repos/olsonpm/js-beautify/contents/{+path}","compare_url":"https://api.github.com/repos/olsonpm/js-beautify/compare/{base}...{head}","merges_url":"https://api.github.com/repos/olsonpm/js-beautify/merges","archive_url":"https://api.github.com/repos/olsonpm/js-beautify/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/olsonpm/js-beautify/downloads","issues_url":"https://api.github.com/repos/olsonpm/js-beautify/issues{/number}","pulls_url":"https://api.github.com/repos/olsonpm/js-beautify/pulls{/number}","milestones_url":"https://api.github.com/repos/olsonpm/js-beautify/milestones{/number}","notifications_url":"https://api.github.com/repos/olsonpm/js-beautify/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/olsonpm/js-beautify/labels{/name}","releases_url":"https://api.github.com/repos/olsonpm/js-beautify/releases{/id}","created_at":"2015-06-01T05:38:45Z","updated_at":"2015-06-01T05:38:45Z","pushed_at":"2015-07-16T05:58:55Z","git_url":"git://github.com/olsonpm/js-beautify.git","ssh_url":"git@github.com:olsonpm/js-beautify.git","clone_url":"https://github.com/olsonpm/js-beautify.git","svn_url":"https://github.com/olsonpm/js-beautify","homepage":"http://jsbeautifier.org/","size":4050,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":false,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"beautify-web:master","ref":"master","sha":"334ffa2fe657e7e1612c9ad4ab4a96abcd2acec4","user":{"login":"beautify-web","id":6538164,"avatar_url":"https://avatars.githubusercontent.com/u/6538164?v=3","gravatar_id":"","url":"https://api.github.com/users/beautify-web","html_url":"https://github.com/beautify-web","followers_url":"https://api.github.com/users/beautify-web/followers","following_url":"https://api.github.com/users/beautify-web/following{/other_user}","gists_url":"https://api.github.com/users/beautify-web/gists{/gist_id}","starred_url":"https://api.github.com/users/beautify-web/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beautify-web/subscriptions","organizations_url":"https://api.github.com/users/beautify-web/orgs","repos_url":"https://api.github.com/users/beautify-web/repos","events_url":"https://api.github.com/users/beautify-web/events{/privacy}","received_events_url":"https://api.github.com/users/beautify-web/received_events","type":"Organization","site_admin":false},"repo":{"id":84822,"name":"js-beautify","full_name":"beautify-web/js-beautify","owner":{"login":"beautify-web","id":6538164,"avatar_url":"https://avatars.githubusercontent.com/u/6538164?v=3","gravatar_id":"","url":"https://api.github.com/users/beautify-web","html_url":"https://github.com/beautify-web","followers_url":"https://api.github.com/users/beautify-web/followers","following_url":"https://api.github.com/users/beautify-web/following{/other_user}","gists_url":"https://api.github.com/users/beautify-web/gists{/gist_id}","starred_url":"https://api.github.com/users/beautify-web/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beautify-web/subscriptions","organizations_url":"https://api.github.com/users/beautify-web/orgs","repos_url":"https://api.github.com/users/beautify-web/repos","events_url":"https://api.github.com/users/beautify-web/events{/privacy}","received_events_url":"https://api.github.com/users/beautify-web/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/beautify-web/js-beautify","description":"Beautifier for javascript","fork":false,"url":"https://api.github.com/repos/beautify-web/js-beautify","forks_url":"https://api.github.com/repos/beautify-web/js-beautify/forks","keys_url":"https://api.github.com/repos/beautify-web/js-beautify/keys{/key_id}","collaborators_url":"https://api.github.com/repos/beautify-web/js-beautify/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/beautify-web/js-beautify/teams","hooks_url":"https://api.github.com/repos/beautify-web/js-beautify/hooks","issue_events_url":"https://api.github.com/repos/beautify-web/js-beautify/issues/events{/number}","events_url":"https://api.github.com/repos/beautify-web/js-beautify/events","assignees_url":"https://api.github.com/repos/beautify-web/js-beautify/assignees{/user}","branches_url":"https://api.github.com/repos/beautify-web/js-beautify/branches{/branch}","tags_url":"https://api.github.com/repos/beautify-web/js-beautify/tags","blobs_url":"https://api.github.com/repos/beautify-web/js-beautify/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/beautify-web/js-beautify/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/beautify-web/js-beautify/git/refs{/sha}","trees_url":"https://api.github.com/repos/beautify-web/js-beautify/git/trees{/sha}","statuses_url":"https://api.github.com/repos/beautify-web/js-beautify/statuses/{sha}","languages_url":"https://api.github.com/repos/beautify-web/js-beautify/languages","stargazers_url":"https://api.github.com/repos/beautify-web/js-beautify/stargazers","contributors_url":"https://api.github.com/repos/beautify-web/js-beautify/contributors","subscribers_url":"https://api.github.com/repos/beautify-web/js-beautify/subscribers","subscription_url":"https://api.github.com/repos/beautify-web/js-beautify/subscription","commits_url":"https://api.github.com/repos/beautify-web/js-beautify/commits{/sha}","git_commits_url":"https://api.github.com/repos/beautify-web/js-beautify/git/commits{/sha}","comments_url":"https://api.github.com/repos/beautify-web/js-beautify/comments{/number}","issue_comment_url":"https://api.github.com/repos/beautify-web/js-beautify/issues/comments{/number}","contents_url":"https://api.github.com/repos/beautify-web/js-beautify/contents/{+path}","compare_url":"https://api.github.com/repos/beautify-web/js-beautify/compare/{base}...{head}","merges_url":"https://api.github.com/repos/beautify-web/js-beautify/merges","archive_url":"https://api.github.com/repos/beautify-web/js-beautify/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/beautify-web/js-beautify/downloads","issues_url":"https://api.github.com/repos/beautify-web/js-beautify/issues{/number}","pulls_url":"https://api.github.com/repos/beautify-web/js-beautify/pulls{/number}","milestones_url":"https://api.github.com/repos/beautify-web/js-beautify/milestones{/number}","notifications_url":"https://api.github.com/repos/beautify-web/js-beautify/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/beautify-web/js-beautify/labels{/name}","releases_url":"https://api.github.com/repos/beautify-web/js-beautify/releases{/id}","created_at":"2008-12-04T06:35:54Z","updated_at":"2015-07-20T18:16:32Z","pushed_at":"2015-07-16T06:00:10Z","git_url":"git://github.com/beautify-web/js-beautify.git","ssh_url":"git@github.com:beautify-web/js-beautify.git","clone_url":"https://github.com/beautify-web/js-beautify.git","svn_url":"https://github.com/beautify-web/js-beautify","homepage":"http://jsbeautifier.org/","size":7474,"stargazers_count":2986,"watchers_count":2986,"language":"JavaScript","has_issues":true,"has_downloads":false,"has_wiki":true,"has_pages":true,"forks_count":612,"mirror_url":null,"open_issues_count":175,"forks":612,"open_issues":175,"watchers":2986,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/beautify-web/js-beautify/pulls/735"},"html":{"href":"https://github.com/beautify-web/js-beautify/pull/735"},"issue":{"href":"https://api.github.com/repos/beautify-web/js-beautify/issues/735"},"comments":{"href":"https://api.github.com/repos/beautify-web/js-beautify/issues/735/comments"},"review_comments":{"href":"https://api.github.com/repos/beautify-web/js-beautify/pulls/735/comments"},"review_comment":{"href":"https://api.github.com/repos/beautify-web/js-beautify/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/beautify-web/js-beautify/pulls/735/commits"},"statuses":{"href":"https://api.github.com/repos/beautify-web/js-beautify/statuses/6503d3a1645f4d168b08796f3dc7b9660aabadee"}}}}