{"action":"created","comment":{"url":"https://api.github.com/repos/sindresorhus/dot-prop/pulls/comments/28307417","id":28307417,"diff_hunk":"@@ -1,15 +1,28 @@\n 'use strict';\n+var each = require('lodash.foreach');\n+var isUndefined = require('lodash.isundefined');\n \n-function isObject(x) {\n-\treturn typeof x === 'object' && x !== null;\n-}\n+module.exports = function dotProp(obj, path, value) {\n+  if (!path) {\n+    return obj;\n+  }\n \n-module.exports = function getProp(obj, path) {\n-\tif (!isObject(obj) || typeof path !== 'string') {\n-\t\treturn obj;\n-\t}\n+  var argsLen = arguments.length;\n \n-\tpath = path.split('.');\n+  var pathArr = path.split('.');\n+  each(pathArr, function(path, index) {","path":"index.js","position":21,"original_position":21,"commit_id":"078b8613be7736f9548e97016c82b26559c7e2c1","original_commit_id":"078b8613be7736f9548e97016c82b26559c7e2c1","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":"`each(pathArr, function (path, index) {`","created_at":"2015-04-14T08:08:15Z","updated_at":"2015-04-14T08:08:15Z","html_url":"https://github.com/sindresorhus/dot-prop/pull/6#discussion_r28307417","pull_request_url":"https://api.github.com/repos/sindresorhus/dot-prop/pulls/6","_links":{"self":{"href":"https://api.github.com/repos/sindresorhus/dot-prop/pulls/comments/28307417"},"html":{"href":"https://github.com/sindresorhus/dot-prop/pull/6#discussion_r28307417"},"pull_request":{"href":"https://api.github.com/repos/sindresorhus/dot-prop/pulls/6"}}},"pull_request":{"url":"https://api.github.com/repos/sindresorhus/dot-prop/pulls/6","id":33138606,"html_url":"https://github.com/sindresorhus/dot-prop/pull/6","diff_url":"https://github.com/sindresorhus/dot-prop/pull/6.diff","patch_url":"https://github.com/sindresorhus/dot-prop/pull/6.patch","issue_url":"https://api.github.com/repos/sindresorhus/dot-prop/issues/6","number":6,"state":"open","locked":false,"title":"Rewrite this module","user":{"login":"stevemao","id":6316590,"avatar_url":"https://avatars.githubusercontent.com/u/6316590?v=3","gravatar_id":"","url":"https://api.github.com/users/stevemao","html_url":"https://github.com/stevemao","followers_url":"https://api.github.com/users/stevemao/followers","following_url":"https://api.github.com/users/stevemao/following{/other_user}","gists_url":"https://api.github.com/users/stevemao/gists{/gist_id}","starred_url":"https://api.github.com/users/stevemao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevemao/subscriptions","organizations_url":"https://api.github.com/users/stevemao/orgs","repos_url":"https://api.github.com/users/stevemao/repos","events_url":"https://api.github.com/users/stevemao/events{/privacy}","received_events_url":"https://api.github.com/users/stevemao/received_events","type":"User","site_admin":false},"body":"Setter. While it is possible to impliment setter using recursion, it would not work with getter (`t.assert(dotProp(f1, 'foo', 2) === 2);` would fail).\r\nIt avoids recursion. I personally find recursive functions are hard to follow.\r\n`dotProp({foo: {bar: a}}, foo.fake.fake2)` should throw a TypeError instead of returning `undefined`.\r\nUse lodash to avoid reinventing the wheel.","created_at":"2015-04-13T06:30:49Z","updated_at":"2015-04-14T08:08:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c4f51b4969520350e1c6ddfa99e20921c95e3c47","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/sindresorhus/dot-prop/pulls/6/commits","review_comments_url":"https://api.github.com/repos/sindresorhus/dot-prop/pulls/6/comments","review_comment_url":"https://api.github.com/repos/sindresorhus/dot-prop/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sindresorhus/dot-prop/issues/6/comments","statuses_url":"https://api.github.com/repos/sindresorhus/dot-prop/statuses/078b8613be7736f9548e97016c82b26559c7e2c1","head":{"label":"stevemao:setter","ref":"setter","sha":"078b8613be7736f9548e97016c82b26559c7e2c1","user":{"login":"stevemao","id":6316590,"avatar_url":"https://avatars.githubusercontent.com/u/6316590?v=3","gravatar_id":"","url":"https://api.github.com/users/stevemao","html_url":"https://github.com/stevemao","followers_url":"https://api.github.com/users/stevemao/followers","following_url":"https://api.github.com/users/stevemao/following{/other_user}","gists_url":"https://api.github.com/users/stevemao/gists{/gist_id}","starred_url":"https://api.github.com/users/stevemao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevemao/subscriptions","organizations_url":"https://api.github.com/users/stevemao/orgs","repos_url":"https://api.github.com/users/stevemao/repos","events_url":"https://api.github.com/users/stevemao/events{/privacy}","received_events_url":"https://api.github.com/users/stevemao/received_events","type":"User","site_admin":false},"repo":{"id":33359311,"name":"dot-prop","full_name":"stevemao/dot-prop","owner":{"login":"stevemao","id":6316590,"avatar_url":"https://avatars.githubusercontent.com/u/6316590?v=3","gravatar_id":"","url":"https://api.github.com/users/stevemao","html_url":"https://github.com/stevemao","followers_url":"https://api.github.com/users/stevemao/followers","following_url":"https://api.github.com/users/stevemao/following{/other_user}","gists_url":"https://api.github.com/users/stevemao/gists{/gist_id}","starred_url":"https://api.github.com/users/stevemao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevemao/subscriptions","organizations_url":"https://api.github.com/users/stevemao/orgs","repos_url":"https://api.github.com/users/stevemao/repos","events_url":"https://api.github.com/users/stevemao/events{/privacy}","received_events_url":"https://api.github.com/users/stevemao/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/stevemao/dot-prop","description":"Get a property from a nested object using a dot path","fork":true,"url":"https://api.github.com/repos/stevemao/dot-prop","forks_url":"https://api.github.com/repos/stevemao/dot-prop/forks","keys_url":"https://api.github.com/repos/stevemao/dot-prop/keys{/key_id}","collaborators_url":"https://api.github.com/repos/stevemao/dot-prop/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/stevemao/dot-prop/teams","hooks_url":"https://api.github.com/repos/stevemao/dot-prop/hooks","issue_events_url":"https://api.github.com/repos/stevemao/dot-prop/issues/events{/number}","events_url":"https://api.github.com/repos/stevemao/dot-prop/events","assignees_url":"https://api.github.com/repos/stevemao/dot-prop/assignees{/user}","branches_url":"https://api.github.com/repos/stevemao/dot-prop/branches{/branch}","tags_url":"https://api.github.com/repos/stevemao/dot-prop/tags","blobs_url":"https://api.github.com/repos/stevemao/dot-prop/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/stevemao/dot-prop/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/stevemao/dot-prop/git/refs{/sha}","trees_url":"https://api.github.com/repos/stevemao/dot-prop/git/trees{/sha}","statuses_url":"https://api.github.com/repos/stevemao/dot-prop/statuses/{sha}","languages_url":"https://api.github.com/repos/stevemao/dot-prop/languages","stargazers_url":"https://api.github.com/repos/stevemao/dot-prop/stargazers","contributors_url":"https://api.github.com/repos/stevemao/dot-prop/contributors","subscribers_url":"https://api.github.com/repos/stevemao/dot-prop/subscribers","subscription_url":"https://api.github.com/repos/stevemao/dot-prop/subscription","commits_url":"https://api.github.com/repos/stevemao/dot-prop/commits{/sha}","git_commits_url":"https://api.github.com/repos/stevemao/dot-prop/git/commits{/sha}","comments_url":"https://api.github.com/repos/stevemao/dot-prop/comments{/number}","issue_comment_url":"https://api.github.com/repos/stevemao/dot-prop/issues/comments{/number}","contents_url":"https://api.github.com/repos/stevemao/dot-prop/contents/{+path}","compare_url":"https://api.github.com/repos/stevemao/dot-prop/compare/{base}...{head}","merges_url":"https://api.github.com/repos/stevemao/dot-prop/merges","archive_url":"https://api.github.com/repos/stevemao/dot-prop/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/stevemao/dot-prop/downloads","issues_url":"https://api.github.com/repos/stevemao/dot-prop/issues{/number}","pulls_url":"https://api.github.com/repos/stevemao/dot-prop/pulls{/number}","milestones_url":"https://api.github.com/repos/stevemao/dot-prop/milestones{/number}","notifications_url":"https://api.github.com/repos/stevemao/dot-prop/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/stevemao/dot-prop/labels{/name}","releases_url":"https://api.github.com/repos/stevemao/dot-prop/releases{/id}","created_at":"2015-04-03T10:50:18Z","updated_at":"2015-04-03T10:50:19Z","pushed_at":"2015-04-13T06:29:10Z","git_url":"git://github.com/stevemao/dot-prop.git","ssh_url":"git@github.com:stevemao/dot-prop.git","clone_url":"https://github.com/stevemao/dot-prop.git","svn_url":"https://github.com/stevemao/dot-prop","homepage":null,"size":97,"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":"c5aa2b6b35b44d66d981618b83ad6f2666978860","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":28951059,"name":"dot-prop","full_name":"sindresorhus/dot-prop","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/dot-prop","description":"Get a property from a nested object using a dot path","fork":false,"url":"https://api.github.com/repos/sindresorhus/dot-prop","forks_url":"https://api.github.com/repos/sindresorhus/dot-prop/forks","keys_url":"https://api.github.com/repos/sindresorhus/dot-prop/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sindresorhus/dot-prop/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sindresorhus/dot-prop/teams","hooks_url":"https://api.github.com/repos/sindresorhus/dot-prop/hooks","issue_events_url":"https://api.github.com/repos/sindresorhus/dot-prop/issues/events{/number}","events_url":"https://api.github.com/repos/sindresorhus/dot-prop/events","assignees_url":"https://api.github.com/repos/sindresorhus/dot-prop/assignees{/user}","branches_url":"https://api.github.com/repos/sindresorhus/dot-prop/branches{/branch}","tags_url":"https://api.github.com/repos/sindresorhus/dot-prop/tags","blobs_url":"https://api.github.com/repos/sindresorhus/dot-prop/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sindresorhus/dot-prop/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sindresorhus/dot-prop/git/refs{/sha}","trees_url":"https://api.github.com/repos/sindresorhus/dot-prop/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sindresorhus/dot-prop/statuses/{sha}","languages_url":"https://api.github.com/repos/sindresorhus/dot-prop/languages","stargazers_url":"https://api.github.com/repos/sindresorhus/dot-prop/stargazers","contributors_url":"https://api.github.com/repos/sindresorhus/dot-prop/contributors","subscribers_url":"https://api.github.com/repos/sindresorhus/dot-prop/subscribers","subscription_url":"https://api.github.com/repos/sindresorhus/dot-prop/subscription","commits_url":"https://api.github.com/repos/sindresorhus/dot-prop/commits{/sha}","git_commits_url":"https://api.github.com/repos/sindresorhus/dot-prop/git/commits{/sha}","comments_url":"https://api.github.com/repos/sindresorhus/dot-prop/comments{/number}","issue_comment_url":"https://api.github.com/repos/sindresorhus/dot-prop/issues/comments{/number}","contents_url":"https://api.github.com/repos/sindresorhus/dot-prop/contents/{+path}","compare_url":"https://api.github.com/repos/sindresorhus/dot-prop/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sindresorhus/dot-prop/merges","archive_url":"https://api.github.com/repos/sindresorhus/dot-prop/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sindresorhus/dot-prop/downloads","issues_url":"https://api.github.com/repos/sindresorhus/dot-prop/issues{/number}","pulls_url":"https://api.github.com/repos/sindresorhus/dot-prop/pulls{/number}","milestones_url":"https://api.github.com/repos/sindresorhus/dot-prop/milestones{/number}","notifications_url":"https://api.github.com/repos/sindresorhus/dot-prop/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sindresorhus/dot-prop/labels{/name}","releases_url":"https://api.github.com/repos/sindresorhus/dot-prop/releases{/id}","created_at":"2015-01-08T05:48:39Z","updated_at":"2015-04-03T13:03:26Z","pushed_at":"2015-04-13T06:30:49Z","git_url":"git://github.com/sindresorhus/dot-prop.git","ssh_url":"git@github.com:sindresorhus/dot-prop.git","clone_url":"https://github.com/sindresorhus/dot-prop.git","svn_url":"https://github.com/sindresorhus/dot-prop","homepage":null,"size":205,"stargazers_count":22,"watchers_count":22,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":2,"forks":4,"open_issues":2,"watchers":22,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sindresorhus/dot-prop/pulls/6"},"html":{"href":"https://github.com/sindresorhus/dot-prop/pull/6"},"issue":{"href":"https://api.github.com/repos/sindresorhus/dot-prop/issues/6"},"comments":{"href":"https://api.github.com/repos/sindresorhus/dot-prop/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/sindresorhus/dot-prop/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/sindresorhus/dot-prop/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sindresorhus/dot-prop/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/sindresorhus/dot-prop/statuses/078b8613be7736f9548e97016c82b26559c7e2c1"}}}}