{"action":"created","comment":{"url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/pulls/comments/210684059","pull_request_review_id":146916040,"id":210684059,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxMDY4NDA1OQ==","diff_hunk":"@@ -0,0 +1,203 @@\n+import toCamelCase from './toCamelCase';\n+\n+describe('utils/objects/toCamelCase', function() {\n+  context('objects', function() {\n+    it('transforms first-level keys', function() {\n+      const transformedObject = toCamelCase({ first_key: 'first value' });\n+\n+      expect(transformedObject).to.deep.equal({ firstKey: 'first value' });\n+    });\n+\n+    it('transforms nested keys by default', function() {\n+      const transformedObject = toCamelCase({\n+        first_level_first_key: {\n+          second_level_first_key: {\n+            third_level_first_key: 'third level first value'\n+          }\n+        }\n+      });\n+\n+      expect(transformedObject).to.deep.equal({\n+        firstLevelFirstKey: {\n+          secondLevelFirstKey: {\n+            thirdLevelFirstKey: 'third level first value'\n+          }\n+        }\n+      });\n+    });\n+\n+    it('does not transform nested keys when `deep` is set to `false`', function() {\n+      const transformedObject = toCamelCase(\n+        {\n+          first_level_first_key: {\n+            second_level_first_key: {\n+              third_level_first_key: 'third level first value'\n+            }\n+          }\n+        },\n+        { deep: false }\n+      );\n+\n+      expect(transformedObject).to.deep.equal({\n+        firstLevelFirstKey: {\n+          second_level_first_key: {\n+            third_level_first_key: 'third level first value'\n+          }\n+        }\n+      });\n+    });\n+\n+    it('does not transform first-level excluded keys', function() {\n+      const transformedObject = toCamelCase(\n+        {\n+          first_key: 'first value',\n+          second_key: 'second value'\n+        },\n+        { excludeTransform: ['second_key'] }\n+      );\n+\n+      expect(transformedObject).to.deep.equal({\n+        firstKey: 'first value',\n+        second_key: 'second value'\n+      });\n+    });\n+\n+    it('does not transform nested excluded keys', function() {\n+      const transformedObject = toCamelCase(\n+        {\n+          first_level_first_key: {\n+            second_level_first_key: {\n+              third_levl_first_key: 'third level first value'","path":"src/utils/objects/toCamelCase.spec.js","position":70,"original_position":70,"commit_id":"062fd1d43589684d7e619878cc461f9300c2629c","original_commit_id":"062fd1d43589684d7e619878cc461f9300c2629c","user":{"login":"leeallen337","id":10897808,"node_id":"MDQ6VXNlcjEwODk3ODA4","avatar_url":"https://avatars3.githubusercontent.com/u/10897808?v=4","gravatar_id":"","url":"https://api.github.com/users/leeallen337","html_url":"https://github.com/leeallen337","followers_url":"https://api.github.com/users/leeallen337/followers","following_url":"https://api.github.com/users/leeallen337/following{/other_user}","gists_url":"https://api.github.com/users/leeallen337/gists{/gist_id}","starred_url":"https://api.github.com/users/leeallen337/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leeallen337/subscriptions","organizations_url":"https://api.github.com/users/leeallen337/orgs","repos_url":"https://api.github.com/users/leeallen337/repos","events_url":"https://api.github.com/users/leeallen337/events{/privacy}","received_events_url":"https://api.github.com/users/leeallen337/received_events","type":"User","site_admin":false},"body":"`third_level_first_key`?","created_at":"2018-08-16T17:46:47Z","updated_at":"2018-08-16T17:51:20Z","html_url":"https://github.com/ndustrialio/contxt-sdk-js/pull/66#discussion_r210684059","pull_request_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/pulls/66","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/pulls/comments/210684059"},"html":{"href":"https://github.com/ndustrialio/contxt-sdk-js/pull/66#discussion_r210684059"},"pull_request":{"href":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/pulls/66"}}},"pull_request":{"url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/pulls/66","id":208598709,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA4NTk4NzA5","html_url":"https://github.com/ndustrialio/contxt-sdk-js/pull/66","diff_url":"https://github.com/ndustrialio/contxt-sdk-js/pull/66.diff","patch_url":"https://github.com/ndustrialio/contxt-sdk-js/pull/66.patch","issue_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/issues/66","number":66,"state":"open","locked":false,"title":"Switch to generic/non-bespoke formatters","user":{"login":"greg5green","id":1641918,"node_id":"MDQ6VXNlcjE2NDE5MTg=","avatar_url":"https://avatars1.githubusercontent.com/u/1641918?v=4","gravatar_id":"","url":"https://api.github.com/users/greg5green","html_url":"https://github.com/greg5green","followers_url":"https://api.github.com/users/greg5green/followers","following_url":"https://api.github.com/users/greg5green/following{/other_user}","gists_url":"https://api.github.com/users/greg5green/gists{/gist_id}","starred_url":"https://api.github.com/users/greg5green/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/greg5green/subscriptions","organizations_url":"https://api.github.com/users/greg5green/orgs","repos_url":"https://api.github.com/users/greg5green/repos","events_url":"https://api.github.com/users/greg5green/events{/privacy}","received_events_url":"https://api.github.com/users/greg5green/received_events","type":"User","site_admin":false},"body":"## Why?\r\n1. Early on, it was a [poor] design choice to create a formatter for each data type. It was getting unmaintainable and hard to manage. (See #47)\r\n2. With update actions, we were a little too permissive with what was getting passed through -- if passing in the original object returned from an API with only one field updated, it would usually throw an error since the APIs were checking to make sure certain keys were not being updated.\r\n\r\n## What changed?\r\n- Added `toCamelCase` and `toSnakeCase` generic formatters\r\n  - Utilizes [`change-case`](https://github.com/blakeembrey/change-case) to manage changing the case of keys\r\n  - Uses a `mapObj` function which is based on the [`map-obj` library](https://github.com/sindresorhus/map-obj), with the added ability to leave/exclude keys from the new object\r\n  - `createCaseChangeFn` function is used to create different \"change case\" functions. It's only used to create ones for snake_case and camelCase at the moment, but can be used to create any case provided in `change-case` (or any custom functions that operate the same as functions provided in `change-case`)\r\n  - Based on [`camelcase-keys`](https://github.com/sindresorhus/camelcase-keys), but with the ability to exclude keys and convert to other cases than just camelCase\r\n\r\nCloses #47 ","created_at":"2018-08-15T15:35:35Z","updated_at":"2018-08-16T17:51:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b126113b54ebe396e46485c95805defaec3aad0b","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/pulls/66/commits","review_comments_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/pulls/66/comments","review_comment_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/issues/66/comments","statuses_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/statuses/062fd1d43589684d7e619878cc461f9300c2629c","head":{"label":"ndustrialio:bug/fix-updates","ref":"bug/fix-updates","sha":"062fd1d43589684d7e619878cc461f9300c2629c","user":{"login":"ndustrialio","id":15110047,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE1MTEwMDQ3","avatar_url":"https://avatars2.githubusercontent.com/u/15110047?v=4","gravatar_id":"","url":"https://api.github.com/users/ndustrialio","html_url":"https://github.com/ndustrialio","followers_url":"https://api.github.com/users/ndustrialio/followers","following_url":"https://api.github.com/users/ndustrialio/following{/other_user}","gists_url":"https://api.github.com/users/ndustrialio/gists{/gist_id}","starred_url":"https://api.github.com/users/ndustrialio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ndustrialio/subscriptions","organizations_url":"https://api.github.com/users/ndustrialio/orgs","repos_url":"https://api.github.com/users/ndustrialio/repos","events_url":"https://api.github.com/users/ndustrialio/events{/privacy}","received_events_url":"https://api.github.com/users/ndustrialio/received_events","type":"Organization","site_admin":false},"repo":{"id":118623043,"node_id":"MDEwOlJlcG9zaXRvcnkxMTg2MjMwNDM=","name":"contxt-sdk-js","full_name":"ndustrialio/contxt-sdk-js","owner":{"login":"ndustrialio","id":15110047,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE1MTEwMDQ3","avatar_url":"https://avatars2.githubusercontent.com/u/15110047?v=4","gravatar_id":"","url":"https://api.github.com/users/ndustrialio","html_url":"https://github.com/ndustrialio","followers_url":"https://api.github.com/users/ndustrialio/followers","following_url":"https://api.github.com/users/ndustrialio/following{/other_user}","gists_url":"https://api.github.com/users/ndustrialio/gists{/gist_id}","starred_url":"https://api.github.com/users/ndustrialio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ndustrialio/subscriptions","organizations_url":"https://api.github.com/users/ndustrialio/orgs","repos_url":"https://api.github.com/users/ndustrialio/repos","events_url":"https://api.github.com/users/ndustrialio/events{/privacy}","received_events_url":"https://api.github.com/users/ndustrialio/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ndustrialio/contxt-sdk-js","description":null,"fork":false,"url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js","forks_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/forks","keys_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/teams","hooks_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/hooks","issue_events_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/issues/events{/number}","events_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/events","assignees_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/assignees{/user}","branches_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/branches{/branch}","tags_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/tags","blobs_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/git/refs{/sha}","trees_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/statuses/{sha}","languages_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/languages","stargazers_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/stargazers","contributors_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/contributors","subscribers_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/subscribers","subscription_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/subscription","commits_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/commits{/sha}","git_commits_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/git/commits{/sha}","comments_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/comments{/number}","issue_comment_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/issues/comments{/number}","contents_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/contents/{+path}","compare_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/merges","archive_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/downloads","issues_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/issues{/number}","pulls_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/pulls{/number}","milestones_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/milestones{/number}","notifications_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/labels{/name}","releases_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/releases{/id}","deployments_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/deployments","created_at":"2018-01-23T14:41:16Z","updated_at":"2018-08-15T13:24:32Z","pushed_at":"2018-08-15T17:20:34Z","git_url":"git://github.com/ndustrialio/contxt-sdk-js.git","ssh_url":"git@github.com:ndustrialio/contxt-sdk-js.git","clone_url":"https://github.com/ndustrialio/contxt-sdk-js.git","svn_url":"https://github.com/ndustrialio/contxt-sdk-js","homepage":null,"size":820,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":3,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"base":{"label":"ndustrialio:master","ref":"master","sha":"7d9dca50cec9e5d7e79db3fd90893bc214c8942a","user":{"login":"ndustrialio","id":15110047,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE1MTEwMDQ3","avatar_url":"https://avatars2.githubusercontent.com/u/15110047?v=4","gravatar_id":"","url":"https://api.github.com/users/ndustrialio","html_url":"https://github.com/ndustrialio","followers_url":"https://api.github.com/users/ndustrialio/followers","following_url":"https://api.github.com/users/ndustrialio/following{/other_user}","gists_url":"https://api.github.com/users/ndustrialio/gists{/gist_id}","starred_url":"https://api.github.com/users/ndustrialio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ndustrialio/subscriptions","organizations_url":"https://api.github.com/users/ndustrialio/orgs","repos_url":"https://api.github.com/users/ndustrialio/repos","events_url":"https://api.github.com/users/ndustrialio/events{/privacy}","received_events_url":"https://api.github.com/users/ndustrialio/received_events","type":"Organization","site_admin":false},"repo":{"id":118623043,"node_id":"MDEwOlJlcG9zaXRvcnkxMTg2MjMwNDM=","name":"contxt-sdk-js","full_name":"ndustrialio/contxt-sdk-js","owner":{"login":"ndustrialio","id":15110047,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE1MTEwMDQ3","avatar_url":"https://avatars2.githubusercontent.com/u/15110047?v=4","gravatar_id":"","url":"https://api.github.com/users/ndustrialio","html_url":"https://github.com/ndustrialio","followers_url":"https://api.github.com/users/ndustrialio/followers","following_url":"https://api.github.com/users/ndustrialio/following{/other_user}","gists_url":"https://api.github.com/users/ndustrialio/gists{/gist_id}","starred_url":"https://api.github.com/users/ndustrialio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ndustrialio/subscriptions","organizations_url":"https://api.github.com/users/ndustrialio/orgs","repos_url":"https://api.github.com/users/ndustrialio/repos","events_url":"https://api.github.com/users/ndustrialio/events{/privacy}","received_events_url":"https://api.github.com/users/ndustrialio/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ndustrialio/contxt-sdk-js","description":null,"fork":false,"url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js","forks_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/forks","keys_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/teams","hooks_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/hooks","issue_events_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/issues/events{/number}","events_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/events","assignees_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/assignees{/user}","branches_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/branches{/branch}","tags_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/tags","blobs_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/git/refs{/sha}","trees_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/statuses/{sha}","languages_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/languages","stargazers_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/stargazers","contributors_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/contributors","subscribers_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/subscribers","subscription_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/subscription","commits_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/commits{/sha}","git_commits_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/git/commits{/sha}","comments_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/comments{/number}","issue_comment_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/issues/comments{/number}","contents_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/contents/{+path}","compare_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/merges","archive_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/downloads","issues_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/issues{/number}","pulls_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/pulls{/number}","milestones_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/milestones{/number}","notifications_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/labels{/name}","releases_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/releases{/id}","deployments_url":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/deployments","created_at":"2018-01-23T14:41:16Z","updated_at":"2018-08-15T13:24:32Z","pushed_at":"2018-08-15T17:20:34Z","git_url":"git://github.com/ndustrialio/contxt-sdk-js.git","ssh_url":"git@github.com:ndustrialio/contxt-sdk-js.git","clone_url":"https://github.com/ndustrialio/contxt-sdk-js.git","svn_url":"https://github.com/ndustrialio/contxt-sdk-js","homepage":null,"size":820,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":3,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/pulls/66"},"html":{"href":"https://github.com/ndustrialio/contxt-sdk-js/pull/66"},"issue":{"href":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/issues/66"},"comments":{"href":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/issues/66/comments"},"review_comments":{"href":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/pulls/66/comments"},"review_comment":{"href":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/pulls/66/commits"},"statuses":{"href":"https://api.github.com/repos/ndustrialio/contxt-sdk-js/statuses/062fd1d43589684d7e619878cc461f9300c2629c"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"leeallen337"}}