{"action":"created","comment":{"url":"https://api.github.com/repos/sindresorhus/camelcase/pulls/comments/48602165","id":48602165,"diff_hunk":"@@ -26,6 +26,18 @@ module.exports = function () {\n \t\treturn str;\n \t}\n \n+\tvar isLastCharLower = false;\n+\tfor (var i = 0; i < str.length; i++) {\n+\t\tvar c = str.charAt(i);\n+\t\tif (isLastCharLower && c.toUpperCase() === c) {\n+\t\t\tstr = str.substr(0, i) + '-' + str.substr(i);\n+\t\t\tisLastCharLower = false;\n+\t\t\ti++;\n+\t\t} else {\n+\t\t\tisLastCharLower = (c.toLowerCase() === c);\n+\t\t}\n+\t}\n+","path":"index.js","position":15,"original_position":15,"commit_id":"2e8f51d679aef9ec2e712c6752e55a416b61f0b4","original_commit_id":"2e8f51d679aef9ec2e712c6752e55a416b61f0b4","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},"body":"Ah, good point. I guess `FBBazzy-style` => `fbbazzyStyle` is fine then.\r\n\r\nI also think https://github.com/sindresorhus/camelcase/blob/b4c5c8d65d01576496eefe5132276eee409029ce/test.js#L25 is incorrect. `fooBar-baz` should become `fooBarBaz`, not `foobarBaz`. It should try to preserve existing camelcasing whenever possible.","created_at":"2015-12-30T12:49:55Z","updated_at":"2015-12-30T12:49:55Z","html_url":"https://github.com/sindresorhus/camelcase/pull/12#discussion_r48602165","pull_request_url":"https://api.github.com/repos/sindresorhus/camelcase/pulls/12","_links":{"self":{"href":"https://api.github.com/repos/sindresorhus/camelcase/pulls/comments/48602165"},"html":{"href":"https://github.com/sindresorhus/camelcase/pull/12#discussion_r48602165"},"pull_request":{"href":"https://api.github.com/repos/sindresorhus/camelcase/pulls/12"}}},"pull_request":{"url":"https://api.github.com/repos/sindresorhus/camelcase/pulls/12","id":54676401,"html_url":"https://github.com/sindresorhus/camelcase/pull/12","diff_url":"https://github.com/sindresorhus/camelcase/pull/12.diff","patch_url":"https://github.com/sindresorhus/camelcase/pull/12.patch","issue_url":"https://api.github.com/repos/sindresorhus/camelcase/issues/12","number":12,"state":"open","locked":false,"title":"Fix #11: already camel case segment become lowercase","user":{"login":"DavidePastore","id":1949364,"avatar_url":"https://avatars.githubusercontent.com/u/1949364?v=3","gravatar_id":"","url":"https://api.github.com/users/DavidePastore","html_url":"https://github.com/DavidePastore","followers_url":"https://api.github.com/users/DavidePastore/followers","following_url":"https://api.github.com/users/DavidePastore/following{/other_user}","gists_url":"https://api.github.com/users/DavidePastore/gists{/gist_id}","starred_url":"https://api.github.com/users/DavidePastore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DavidePastore/subscriptions","organizations_url":"https://api.github.com/users/DavidePastore/orgs","repos_url":"https://api.github.com/users/DavidePastore/repos","events_url":"https://api.github.com/users/DavidePastore/events{/privacy}","received_events_url":"https://api.github.com/users/DavidePastore/received_events","type":"User","site_admin":false},"body":"Related to #11 .","created_at":"2015-12-28T19:06:40Z","updated_at":"2015-12-30T12:49:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7054fd1751a6fc968790833cfd997ea9a416b1f2","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/sindresorhus/camelcase/pulls/12/commits","review_comments_url":"https://api.github.com/repos/sindresorhus/camelcase/pulls/12/comments","review_comment_url":"https://api.github.com/repos/sindresorhus/camelcase/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sindresorhus/camelcase/issues/12/comments","statuses_url":"https://api.github.com/repos/sindresorhus/camelcase/statuses/2e8f51d679aef9ec2e712c6752e55a416b61f0b4","head":{"label":"DavidePastore:fix-issue-11","ref":"fix-issue-11","sha":"2e8f51d679aef9ec2e712c6752e55a416b61f0b4","user":{"login":"DavidePastore","id":1949364,"avatar_url":"https://avatars.githubusercontent.com/u/1949364?v=3","gravatar_id":"","url":"https://api.github.com/users/DavidePastore","html_url":"https://github.com/DavidePastore","followers_url":"https://api.github.com/users/DavidePastore/followers","following_url":"https://api.github.com/users/DavidePastore/following{/other_user}","gists_url":"https://api.github.com/users/DavidePastore/gists{/gist_id}","starred_url":"https://api.github.com/users/DavidePastore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DavidePastore/subscriptions","organizations_url":"https://api.github.com/users/DavidePastore/orgs","repos_url":"https://api.github.com/users/DavidePastore/repos","events_url":"https://api.github.com/users/DavidePastore/events{/privacy}","received_events_url":"https://api.github.com/users/DavidePastore/received_events","type":"User","site_admin":false},"repo":{"id":48704913,"name":"camelcase","full_name":"DavidePastore/camelcase","owner":{"login":"DavidePastore","id":1949364,"avatar_url":"https://avatars.githubusercontent.com/u/1949364?v=3","gravatar_id":"","url":"https://api.github.com/users/DavidePastore","html_url":"https://github.com/DavidePastore","followers_url":"https://api.github.com/users/DavidePastore/followers","following_url":"https://api.github.com/users/DavidePastore/following{/other_user}","gists_url":"https://api.github.com/users/DavidePastore/gists{/gist_id}","starred_url":"https://api.github.com/users/DavidePastore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DavidePastore/subscriptions","organizations_url":"https://api.github.com/users/DavidePastore/orgs","repos_url":"https://api.github.com/users/DavidePastore/repos","events_url":"https://api.github.com/users/DavidePastore/events{/privacy}","received_events_url":"https://api.github.com/users/DavidePastore/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/DavidePastore/camelcase","description":"Convert a dash/dot/underscore/space separated string to camelCase: foo-bar → fooBar","fork":true,"url":"https://api.github.com/repos/DavidePastore/camelcase","forks_url":"https://api.github.com/repos/DavidePastore/camelcase/forks","keys_url":"https://api.github.com/repos/DavidePastore/camelcase/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DavidePastore/camelcase/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DavidePastore/camelcase/teams","hooks_url":"https://api.github.com/repos/DavidePastore/camelcase/hooks","issue_events_url":"https://api.github.com/repos/DavidePastore/camelcase/issues/events{/number}","events_url":"https://api.github.com/repos/DavidePastore/camelcase/events","assignees_url":"https://api.github.com/repos/DavidePastore/camelcase/assignees{/user}","branches_url":"https://api.github.com/repos/DavidePastore/camelcase/branches{/branch}","tags_url":"https://api.github.com/repos/DavidePastore/camelcase/tags","blobs_url":"https://api.github.com/repos/DavidePastore/camelcase/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DavidePastore/camelcase/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DavidePastore/camelcase/git/refs{/sha}","trees_url":"https://api.github.com/repos/DavidePastore/camelcase/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DavidePastore/camelcase/statuses/{sha}","languages_url":"https://api.github.com/repos/DavidePastore/camelcase/languages","stargazers_url":"https://api.github.com/repos/DavidePastore/camelcase/stargazers","contributors_url":"https://api.github.com/repos/DavidePastore/camelcase/contributors","subscribers_url":"https://api.github.com/repos/DavidePastore/camelcase/subscribers","subscription_url":"https://api.github.com/repos/DavidePastore/camelcase/subscription","commits_url":"https://api.github.com/repos/DavidePastore/camelcase/commits{/sha}","git_commits_url":"https://api.github.com/repos/DavidePastore/camelcase/git/commits{/sha}","comments_url":"https://api.github.com/repos/DavidePastore/camelcase/comments{/number}","issue_comment_url":"https://api.github.com/repos/DavidePastore/camelcase/issues/comments{/number}","contents_url":"https://api.github.com/repos/DavidePastore/camelcase/contents/{+path}","compare_url":"https://api.github.com/repos/DavidePastore/camelcase/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DavidePastore/camelcase/merges","archive_url":"https://api.github.com/repos/DavidePastore/camelcase/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DavidePastore/camelcase/downloads","issues_url":"https://api.github.com/repos/DavidePastore/camelcase/issues{/number}","pulls_url":"https://api.github.com/repos/DavidePastore/camelcase/pulls{/number}","milestones_url":"https://api.github.com/repos/DavidePastore/camelcase/milestones{/number}","notifications_url":"https://api.github.com/repos/DavidePastore/camelcase/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DavidePastore/camelcase/labels{/name}","releases_url":"https://api.github.com/repos/DavidePastore/camelcase/releases{/id}","created_at":"2015-12-28T17:50:37Z","updated_at":"2015-12-28T17:50:38Z","pushed_at":"2015-12-28T19:21:48Z","git_url":"git://github.com/DavidePastore/camelcase.git","ssh_url":"git@github.com:DavidePastore/camelcase.git","clone_url":"https://github.com/DavidePastore/camelcase.git","svn_url":"https://github.com/DavidePastore/camelcase","homepage":"","size":13,"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":"fb178b39412e3b63ef86bf6933089282d74d85c4","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":25116836,"name":"camelcase","full_name":"sindresorhus/camelcase","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/camelcase","description":"Convert a dash/dot/underscore/space separated string to camelCase: foo-bar → fooBar","fork":false,"url":"https://api.github.com/repos/sindresorhus/camelcase","forks_url":"https://api.github.com/repos/sindresorhus/camelcase/forks","keys_url":"https://api.github.com/repos/sindresorhus/camelcase/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sindresorhus/camelcase/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sindresorhus/camelcase/teams","hooks_url":"https://api.github.com/repos/sindresorhus/camelcase/hooks","issue_events_url":"https://api.github.com/repos/sindresorhus/camelcase/issues/events{/number}","events_url":"https://api.github.com/repos/sindresorhus/camelcase/events","assignees_url":"https://api.github.com/repos/sindresorhus/camelcase/assignees{/user}","branches_url":"https://api.github.com/repos/sindresorhus/camelcase/branches{/branch}","tags_url":"https://api.github.com/repos/sindresorhus/camelcase/tags","blobs_url":"https://api.github.com/repos/sindresorhus/camelcase/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sindresorhus/camelcase/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sindresorhus/camelcase/git/refs{/sha}","trees_url":"https://api.github.com/repos/sindresorhus/camelcase/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sindresorhus/camelcase/statuses/{sha}","languages_url":"https://api.github.com/repos/sindresorhus/camelcase/languages","stargazers_url":"https://api.github.com/repos/sindresorhus/camelcase/stargazers","contributors_url":"https://api.github.com/repos/sindresorhus/camelcase/contributors","subscribers_url":"https://api.github.com/repos/sindresorhus/camelcase/subscribers","subscription_url":"https://api.github.com/repos/sindresorhus/camelcase/subscription","commits_url":"https://api.github.com/repos/sindresorhus/camelcase/commits{/sha}","git_commits_url":"https://api.github.com/repos/sindresorhus/camelcase/git/commits{/sha}","comments_url":"https://api.github.com/repos/sindresorhus/camelcase/comments{/number}","issue_comment_url":"https://api.github.com/repos/sindresorhus/camelcase/issues/comments{/number}","contents_url":"https://api.github.com/repos/sindresorhus/camelcase/contents/{+path}","compare_url":"https://api.github.com/repos/sindresorhus/camelcase/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sindresorhus/camelcase/merges","archive_url":"https://api.github.com/repos/sindresorhus/camelcase/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sindresorhus/camelcase/downloads","issues_url":"https://api.github.com/repos/sindresorhus/camelcase/issues{/number}","pulls_url":"https://api.github.com/repos/sindresorhus/camelcase/pulls{/number}","milestones_url":"https://api.github.com/repos/sindresorhus/camelcase/milestones{/number}","notifications_url":"https://api.github.com/repos/sindresorhus/camelcase/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sindresorhus/camelcase/labels{/name}","releases_url":"https://api.github.com/repos/sindresorhus/camelcase/releases{/id}","created_at":"2014-10-12T10:58:21Z","updated_at":"2015-12-28T20:36:17Z","pushed_at":"2015-12-30T08:48:29Z","git_url":"git://github.com/sindresorhus/camelcase.git","ssh_url":"git@github.com:sindresorhus/camelcase.git","clone_url":"https://github.com/sindresorhus/camelcase.git","svn_url":"https://github.com/sindresorhus/camelcase","homepage":"","size":17,"stargazers_count":37,"watchers_count":37,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":2,"forks":8,"open_issues":2,"watchers":37,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sindresorhus/camelcase/pulls/12"},"html":{"href":"https://github.com/sindresorhus/camelcase/pull/12"},"issue":{"href":"https://api.github.com/repos/sindresorhus/camelcase/issues/12"},"comments":{"href":"https://api.github.com/repos/sindresorhus/camelcase/issues/12/comments"},"review_comments":{"href":"https://api.github.com/repos/sindresorhus/camelcase/pulls/12/comments"},"review_comment":{"href":"https://api.github.com/repos/sindresorhus/camelcase/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sindresorhus/camelcase/pulls/12/commits"},"statuses":{"href":"https://api.github.com/repos/sindresorhus/camelcase/statuses/2e8f51d679aef9ec2e712c6752e55a416b61f0b4"}}}}