{"action":"created","comment":{"url":"https://api.github.com/repos/planswell/kitchen-sink/pulls/comments/78456739","id":78456739,"diff_hunk":"@@ -0,0 +1,117 @@\n+defmodule KitchenSink.Map do\n+  @moduledoc \"\"\"\n+\n+  This module is a mixin for the elixir map namespace\n+\n+  \"\"\"\n+\n+  import KitchenSink.Function\n+  # --------------------- Map.merge/1 ----------------------------------\n+  @doc \"\"\"\n+\n+merge an array of maps! using merge/1\n+\n+  ## Example:\n+\n+  iex> Map.merge [%{a: 1}, %{b: 2}, %{c: 3}, %{d: 4}]\n+  %{a: 1, b: 2, c: 3, d: 4}\n+\n+  \"\"\"\n+  def merge([]) do\n+    %{}\n+  end\n+\n+  def merge([el]) do\n+    el\n+  end\n+\n+  def merge(list) when is_list(list) do\n+    Enum.reduce list, reverse(&Map.merge/2)\n+  end\n+\n+  def merge([el, el2]) do\n+    Map.merge(el, el2)\n+  end\n+\n+  @doc\"\"\"\n+\n+  deep_merge overcomes a limitation of Map.merge in that it will merge\n+  trees. deep_merge will attempt to make the minimum possible change\n+  when it merges 2 trees.\n+\n+\"\"\"\n+  def deep_merge(left, right) do\n+    Map.merge(left, right, &deep_resolve/3)\n+  end\n+\n+  def deep_merge(list) when is_list(list) do\n+    Enum.reduce list, reverse(&deep_merge/2)\n+  end\n+\n+  # Key exists in both maps, and both values are maps as well.\n+  # These can be merged recursively.\n+  defp deep_resolve(_key, left = %{}, right = %{}) do\n+    deep_merge(left, right)\n+  end\n+\n+  # Key exists in both maps, but at least one of the values is\n+  # NOT a map. We fall back to standard merge behavior, preferring\n+  # the value on the right.\n+  defp deep_resolve(_key, _left, right) do\n+    right\n+  end\n+\n+  @doc \"\"\"\n+\n+  rename_key remaps a value from one key to another in a map\n+\n+  ## Example:\n+\n+  iex> Map.rename_key %{a: 1, b: 2, c: 3, d: 4}, :a, :z\n+  %{z: 1, b: 2, c: 3, d: 4}\n+\n+  \"\"\"\n+\n+  def rename_key(map, key_map) when is_map(key_map) and map_size(map) === 1 do","path":"lib/kitchensink/map.ex","position":77,"original_position":75,"commit_id":"b98e1312bbc6b16f3b837da94fc7018a06bb0dc3","original_commit_id":"f12edff384a5833b3b66afd6f9ead84001aa5f85","user":{"login":"boxxxie","id":440034,"avatar_url":"https://avatars.githubusercontent.com/u/440034?v=3","gravatar_id":"","url":"https://api.github.com/users/boxxxie","html_url":"https://github.com/boxxxie","followers_url":"https://api.github.com/users/boxxxie/followers","following_url":"https://api.github.com/users/boxxxie/following{/other_user}","gists_url":"https://api.github.com/users/boxxxie/gists{/gist_id}","starred_url":"https://api.github.com/users/boxxxie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boxxxie/subscriptions","organizations_url":"https://api.github.com/users/boxxxie/orgs","repos_url":"https://api.github.com/users/boxxxie/repos","events_url":"https://api.github.com/users/boxxxie/events{/privacy}","received_events_url":"https://api.github.com/users/boxxxie/received_events","type":"User","site_admin":false},"body":"i may have to rewrite too much for this change... i'll do it later.","created_at":"2016-09-12T21:18:10Z","updated_at":"2016-09-12T21:18:10Z","html_url":"https://github.com/planswell/kitchen-sink/pull/2#discussion_r78456739","pull_request_url":"https://api.github.com/repos/planswell/kitchen-sink/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/planswell/kitchen-sink/pulls/comments/78456739"},"html":{"href":"https://github.com/planswell/kitchen-sink/pull/2#discussion_r78456739"},"pull_request":{"href":"https://api.github.com/repos/planswell/kitchen-sink/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/planswell/kitchen-sink/pulls/2","id":84927192,"html_url":"https://github.com/planswell/kitchen-sink/pull/2","diff_url":"https://github.com/planswell/kitchen-sink/pull/2.diff","patch_url":"https://github.com/planswell/kitchen-sink/pull/2.patch","issue_url":"https://api.github.com/repos/planswell/kitchen-sink/issues/2","number":2,"state":"open","locked":false,"title":"Merge deep merge rename keys","user":{"login":"boxxxie","id":440034,"avatar_url":"https://avatars.githubusercontent.com/u/440034?v=3","gravatar_id":"","url":"https://api.github.com/users/boxxxie","html_url":"https://github.com/boxxxie","followers_url":"https://api.github.com/users/boxxxie/followers","following_url":"https://api.github.com/users/boxxxie/following{/other_user}","gists_url":"https://api.github.com/users/boxxxie/gists{/gist_id}","starred_url":"https://api.github.com/users/boxxxie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boxxxie/subscriptions","organizations_url":"https://api.github.com/users/boxxxie/orgs","repos_url":"https://api.github.com/users/boxxxie/repos","events_url":"https://api.github.com/users/boxxxie/events{/privacy}","received_events_url":"https://api.github.com/users/boxxxie/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-09-12T19:11:42Z","updated_at":"2016-09-12T21:18:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1afebcbb25aa39ad5aa1abe8c72d4eaa832f2e49","assignee":{"login":"olafura","id":292662,"avatar_url":"https://avatars.githubusercontent.com/u/292662?v=3","gravatar_id":"","url":"https://api.github.com/users/olafura","html_url":"https://github.com/olafura","followers_url":"https://api.github.com/users/olafura/followers","following_url":"https://api.github.com/users/olafura/following{/other_user}","gists_url":"https://api.github.com/users/olafura/gists{/gist_id}","starred_url":"https://api.github.com/users/olafura/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/olafura/subscriptions","organizations_url":"https://api.github.com/users/olafura/orgs","repos_url":"https://api.github.com/users/olafura/repos","events_url":"https://api.github.com/users/olafura/events{/privacy}","received_events_url":"https://api.github.com/users/olafura/received_events","type":"User","site_admin":false},"assignees":[{"login":"olafura","id":292662,"avatar_url":"https://avatars.githubusercontent.com/u/292662?v=3","gravatar_id":"","url":"https://api.github.com/users/olafura","html_url":"https://github.com/olafura","followers_url":"https://api.github.com/users/olafura/followers","following_url":"https://api.github.com/users/olafura/following{/other_user}","gists_url":"https://api.github.com/users/olafura/gists{/gist_id}","starred_url":"https://api.github.com/users/olafura/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/olafura/subscriptions","organizations_url":"https://api.github.com/users/olafura/orgs","repos_url":"https://api.github.com/users/olafura/repos","events_url":"https://api.github.com/users/olafura/events{/privacy}","received_events_url":"https://api.github.com/users/olafura/received_events","type":"User","site_admin":false},{"login":"kenips","id":794915,"avatar_url":"https://avatars.githubusercontent.com/u/794915?v=3","gravatar_id":"","url":"https://api.github.com/users/kenips","html_url":"https://github.com/kenips","followers_url":"https://api.github.com/users/kenips/followers","following_url":"https://api.github.com/users/kenips/following{/other_user}","gists_url":"https://api.github.com/users/kenips/gists{/gist_id}","starred_url":"https://api.github.com/users/kenips/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kenips/subscriptions","organizations_url":"https://api.github.com/users/kenips/orgs","repos_url":"https://api.github.com/users/kenips/repos","events_url":"https://api.github.com/users/kenips/events{/privacy}","received_events_url":"https://api.github.com/users/kenips/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/planswell/kitchen-sink/pulls/2/commits","review_comments_url":"https://api.github.com/repos/planswell/kitchen-sink/pulls/2/comments","review_comment_url":"https://api.github.com/repos/planswell/kitchen-sink/pulls/comments{/number}","comments_url":"https://api.github.com/repos/planswell/kitchen-sink/issues/2/comments","statuses_url":"https://api.github.com/repos/planswell/kitchen-sink/statuses/b98e1312bbc6b16f3b837da94fc7018a06bb0dc3","head":{"label":"boxxxie:merge-deep_merge-rename_keys","ref":"merge-deep_merge-rename_keys","sha":"b98e1312bbc6b16f3b837da94fc7018a06bb0dc3","user":{"login":"boxxxie","id":440034,"avatar_url":"https://avatars.githubusercontent.com/u/440034?v=3","gravatar_id":"","url":"https://api.github.com/users/boxxxie","html_url":"https://github.com/boxxxie","followers_url":"https://api.github.com/users/boxxxie/followers","following_url":"https://api.github.com/users/boxxxie/following{/other_user}","gists_url":"https://api.github.com/users/boxxxie/gists{/gist_id}","starred_url":"https://api.github.com/users/boxxxie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boxxxie/subscriptions","organizations_url":"https://api.github.com/users/boxxxie/orgs","repos_url":"https://api.github.com/users/boxxxie/repos","events_url":"https://api.github.com/users/boxxxie/events{/privacy}","received_events_url":"https://api.github.com/users/boxxxie/received_events","type":"User","site_admin":false},"repo":{"id":68039147,"name":"kitchen-sink","full_name":"boxxxie/kitchen-sink","owner":{"login":"boxxxie","id":440034,"avatar_url":"https://avatars.githubusercontent.com/u/440034?v=3","gravatar_id":"","url":"https://api.github.com/users/boxxxie","html_url":"https://github.com/boxxxie","followers_url":"https://api.github.com/users/boxxxie/followers","following_url":"https://api.github.com/users/boxxxie/following{/other_user}","gists_url":"https://api.github.com/users/boxxxie/gists{/gist_id}","starred_url":"https://api.github.com/users/boxxxie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boxxxie/subscriptions","organizations_url":"https://api.github.com/users/boxxxie/orgs","repos_url":"https://api.github.com/users/boxxxie/repos","events_url":"https://api.github.com/users/boxxxie/events{/privacy}","received_events_url":"https://api.github.com/users/boxxxie/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/boxxxie/kitchen-sink","description":"Elixir Stdlib Extensions","fork":true,"url":"https://api.github.com/repos/boxxxie/kitchen-sink","forks_url":"https://api.github.com/repos/boxxxie/kitchen-sink/forks","keys_url":"https://api.github.com/repos/boxxxie/kitchen-sink/keys{/key_id}","collaborators_url":"https://api.github.com/repos/boxxxie/kitchen-sink/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/boxxxie/kitchen-sink/teams","hooks_url":"https://api.github.com/repos/boxxxie/kitchen-sink/hooks","issue_events_url":"https://api.github.com/repos/boxxxie/kitchen-sink/issues/events{/number}","events_url":"https://api.github.com/repos/boxxxie/kitchen-sink/events","assignees_url":"https://api.github.com/repos/boxxxie/kitchen-sink/assignees{/user}","branches_url":"https://api.github.com/repos/boxxxie/kitchen-sink/branches{/branch}","tags_url":"https://api.github.com/repos/boxxxie/kitchen-sink/tags","blobs_url":"https://api.github.com/repos/boxxxie/kitchen-sink/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/boxxxie/kitchen-sink/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/boxxxie/kitchen-sink/git/refs{/sha}","trees_url":"https://api.github.com/repos/boxxxie/kitchen-sink/git/trees{/sha}","statuses_url":"https://api.github.com/repos/boxxxie/kitchen-sink/statuses/{sha}","languages_url":"https://api.github.com/repos/boxxxie/kitchen-sink/languages","stargazers_url":"https://api.github.com/repos/boxxxie/kitchen-sink/stargazers","contributors_url":"https://api.github.com/repos/boxxxie/kitchen-sink/contributors","subscribers_url":"https://api.github.com/repos/boxxxie/kitchen-sink/subscribers","subscription_url":"https://api.github.com/repos/boxxxie/kitchen-sink/subscription","commits_url":"https://api.github.com/repos/boxxxie/kitchen-sink/commits{/sha}","git_commits_url":"https://api.github.com/repos/boxxxie/kitchen-sink/git/commits{/sha}","comments_url":"https://api.github.com/repos/boxxxie/kitchen-sink/comments{/number}","issue_comment_url":"https://api.github.com/repos/boxxxie/kitchen-sink/issues/comments{/number}","contents_url":"https://api.github.com/repos/boxxxie/kitchen-sink/contents/{+path}","compare_url":"https://api.github.com/repos/boxxxie/kitchen-sink/compare/{base}...{head}","merges_url":"https://api.github.com/repos/boxxxie/kitchen-sink/merges","archive_url":"https://api.github.com/repos/boxxxie/kitchen-sink/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/boxxxie/kitchen-sink/downloads","issues_url":"https://api.github.com/repos/boxxxie/kitchen-sink/issues{/number}","pulls_url":"https://api.github.com/repos/boxxxie/kitchen-sink/pulls{/number}","milestones_url":"https://api.github.com/repos/boxxxie/kitchen-sink/milestones{/number}","notifications_url":"https://api.github.com/repos/boxxxie/kitchen-sink/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/boxxxie/kitchen-sink/labels{/name}","releases_url":"https://api.github.com/repos/boxxxie/kitchen-sink/releases{/id}","deployments_url":"https://api.github.com/repos/boxxxie/kitchen-sink/deployments","created_at":"2016-09-12T19:08:52Z","updated_at":"2016-09-12T18:44:49Z","pushed_at":"2016-09-12T20:05:02Z","git_url":"git://github.com/boxxxie/kitchen-sink.git","ssh_url":"git@github.com:boxxxie/kitchen-sink.git","clone_url":"https://github.com/boxxxie/kitchen-sink.git","svn_url":"https://github.com/boxxxie/kitchen-sink","homepage":null,"size":4,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":true,"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":"planswell:master","ref":"master","sha":"55ea7001601170d7377339afbe5297c4452b0116","user":{"login":"planswell","id":19672073,"avatar_url":"https://avatars.githubusercontent.com/u/19672073?v=3","gravatar_id":"","url":"https://api.github.com/users/planswell","html_url":"https://github.com/planswell","followers_url":"https://api.github.com/users/planswell/followers","following_url":"https://api.github.com/users/planswell/following{/other_user}","gists_url":"https://api.github.com/users/planswell/gists{/gist_id}","starred_url":"https://api.github.com/users/planswell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/planswell/subscriptions","organizations_url":"https://api.github.com/users/planswell/orgs","repos_url":"https://api.github.com/users/planswell/repos","events_url":"https://api.github.com/users/planswell/events{/privacy}","received_events_url":"https://api.github.com/users/planswell/received_events","type":"Organization","site_admin":false},"repo":{"id":68024419,"name":"kitchen-sink","full_name":"planswell/kitchen-sink","owner":{"login":"planswell","id":19672073,"avatar_url":"https://avatars.githubusercontent.com/u/19672073?v=3","gravatar_id":"","url":"https://api.github.com/users/planswell","html_url":"https://github.com/planswell","followers_url":"https://api.github.com/users/planswell/followers","following_url":"https://api.github.com/users/planswell/following{/other_user}","gists_url":"https://api.github.com/users/planswell/gists{/gist_id}","starred_url":"https://api.github.com/users/planswell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/planswell/subscriptions","organizations_url":"https://api.github.com/users/planswell/orgs","repos_url":"https://api.github.com/users/planswell/repos","events_url":"https://api.github.com/users/planswell/events{/privacy}","received_events_url":"https://api.github.com/users/planswell/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/planswell/kitchen-sink","description":"Elixir Stdlib Extensions","fork":false,"url":"https://api.github.com/repos/planswell/kitchen-sink","forks_url":"https://api.github.com/repos/planswell/kitchen-sink/forks","keys_url":"https://api.github.com/repos/planswell/kitchen-sink/keys{/key_id}","collaborators_url":"https://api.github.com/repos/planswell/kitchen-sink/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/planswell/kitchen-sink/teams","hooks_url":"https://api.github.com/repos/planswell/kitchen-sink/hooks","issue_events_url":"https://api.github.com/repos/planswell/kitchen-sink/issues/events{/number}","events_url":"https://api.github.com/repos/planswell/kitchen-sink/events","assignees_url":"https://api.github.com/repos/planswell/kitchen-sink/assignees{/user}","branches_url":"https://api.github.com/repos/planswell/kitchen-sink/branches{/branch}","tags_url":"https://api.github.com/repos/planswell/kitchen-sink/tags","blobs_url":"https://api.github.com/repos/planswell/kitchen-sink/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/planswell/kitchen-sink/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/planswell/kitchen-sink/git/refs{/sha}","trees_url":"https://api.github.com/repos/planswell/kitchen-sink/git/trees{/sha}","statuses_url":"https://api.github.com/repos/planswell/kitchen-sink/statuses/{sha}","languages_url":"https://api.github.com/repos/planswell/kitchen-sink/languages","stargazers_url":"https://api.github.com/repos/planswell/kitchen-sink/stargazers","contributors_url":"https://api.github.com/repos/planswell/kitchen-sink/contributors","subscribers_url":"https://api.github.com/repos/planswell/kitchen-sink/subscribers","subscription_url":"https://api.github.com/repos/planswell/kitchen-sink/subscription","commits_url":"https://api.github.com/repos/planswell/kitchen-sink/commits{/sha}","git_commits_url":"https://api.github.com/repos/planswell/kitchen-sink/git/commits{/sha}","comments_url":"https://api.github.com/repos/planswell/kitchen-sink/comments{/number}","issue_comment_url":"https://api.github.com/repos/planswell/kitchen-sink/issues/comments{/number}","contents_url":"https://api.github.com/repos/planswell/kitchen-sink/contents/{+path}","compare_url":"https://api.github.com/repos/planswell/kitchen-sink/compare/{base}...{head}","merges_url":"https://api.github.com/repos/planswell/kitchen-sink/merges","archive_url":"https://api.github.com/repos/planswell/kitchen-sink/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/planswell/kitchen-sink/downloads","issues_url":"https://api.github.com/repos/planswell/kitchen-sink/issues{/number}","pulls_url":"https://api.github.com/repos/planswell/kitchen-sink/pulls{/number}","milestones_url":"https://api.github.com/repos/planswell/kitchen-sink/milestones{/number}","notifications_url":"https://api.github.com/repos/planswell/kitchen-sink/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/planswell/kitchen-sink/labels{/name}","releases_url":"https://api.github.com/repos/planswell/kitchen-sink/releases{/id}","deployments_url":"https://api.github.com/repos/planswell/kitchen-sink/deployments","created_at":"2016-09-12T16:00:22Z","updated_at":"2016-09-12T18:44:49Z","pushed_at":"2016-09-12T20:05:02Z","git_url":"git://github.com/planswell/kitchen-sink.git","ssh_url":"git@github.com:planswell/kitchen-sink.git","clone_url":"https://github.com/planswell/kitchen-sink.git","svn_url":"https://github.com/planswell/kitchen-sink","homepage":null,"size":5,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/planswell/kitchen-sink/pulls/2"},"html":{"href":"https://github.com/planswell/kitchen-sink/pull/2"},"issue":{"href":"https://api.github.com/repos/planswell/kitchen-sink/issues/2"},"comments":{"href":"https://api.github.com/repos/planswell/kitchen-sink/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/planswell/kitchen-sink/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/planswell/kitchen-sink/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/planswell/kitchen-sink/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/planswell/kitchen-sink/statuses/b98e1312bbc6b16f3b837da94fc7018a06bb0dc3"}}}}
{"actor":{"display_login":"boxxxie"}}