{"action":"created","issue":{"url":"https://api.github.com/repos/lodash/lodash/issues/2853","repository_url":"https://api.github.com/repos/lodash/lodash","labels_url":"https://api.github.com/repos/lodash/lodash/issues/2853/labels{/name}","comments_url":"https://api.github.com/repos/lodash/lodash/issues/2853/comments","events_url":"https://api.github.com/repos/lodash/lodash/issues/2853/events","html_url":"https://github.com/lodash/lodash/issues/2853","id":191725578,"number":2853,"title":"Allow to provide a default value for _.invoke, similar to _.get(obj, 'noProp', 'default')","user":{"login":"ArturBaybulatov","id":3109399,"avatar_url":"https://avatars.githubusercontent.com/u/3109399?v=3","gravatar_id":"","url":"https://api.github.com/users/ArturBaybulatov","html_url":"https://github.com/ArturBaybulatov","followers_url":"https://api.github.com/users/ArturBaybulatov/followers","following_url":"https://api.github.com/users/ArturBaybulatov/following{/other_user}","gists_url":"https://api.github.com/users/ArturBaybulatov/gists{/gist_id}","starred_url":"https://api.github.com/users/ArturBaybulatov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ArturBaybulatov/subscriptions","organizations_url":"https://api.github.com/users/ArturBaybulatov/orgs","repos_url":"https://api.github.com/users/ArturBaybulatov/repos","events_url":"https://api.github.com/users/ArturBaybulatov/events{/privacy}","received_events_url":"https://api.github.com/users/ArturBaybulatov/received_events","type":"User","site_admin":false},"labels":[{"id":2763154,"url":"https://api.github.com/repos/lodash/lodash/labels/enhancement","name":"enhancement","color":"84b6eb","default":true},{"id":357705703,"url":"https://api.github.com/repos/lodash/lodash/labels/votes%20needed","name":"votes needed","color":"c5def5","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-11-25T15:34:42Z","updated_at":"2016-11-25T15:56:23Z","closed_at":"2016-11-25T15:56:23Z","body":"This is a feature request (enhancement)\r\n\r\nHaving an object:\r\n\r\n```javascript\r\nvar obj = {\r\n    a: 'foo',\r\n    b: undefined,\r\n    A: function() {return 'FOO'},\r\n    B: function() {return undefined},\r\n}\r\n```\r\n\r\n<table>\r\n<tr>\r\n<th>Current _.get</th>\r\n<th>Current _.invoke</th>\r\n<th>Desired _.invoke</th>\r\n</tr>\r\n\r\n<tr>\r\n<td>_.get(obj, 'a')<br>// =&gt; \"foo\"</td>\r\n<td>_.invoke(obj, 'A')<br>// =&gt; \"FOO\"</td>\r\n<td>same</td>\r\n</tr>\r\n\r\n<tr>\r\n<td>_.get(obj, 'b')<br>// =&gt; undefined</td>\r\n<td>_.invoke(obj, 'B')<br>// =&gt; undefined</td>\r\n<td>same</td>\r\n</tr>\r\n\r\n<tr>\r\n<td>_.get(obj, 'x')<br>// =&gt; undefined</td>\r\n<td>_.invoke(obj, 'X')<br>// =&gt; undefined</td>\r\n<td>same</td>\r\n</tr>\r\n\r\n<tr>\r\n<td></td>\r\n<td>_.invoke(obj, 'a')<br>// &gt;&gt; Error</td>\r\n<td>_.invoke(obj, 'a')<br>// =&gt; undefined</td>\r\n</tr>\r\n\r\n<tr>\r\n<td>_.get(obj, 'b', 'default')<br>// =&gt; \"default\"</td>\r\n<td>add</td>\r\n<td>_.invoke(obj, 'B', 'default')<br>// =&gt; \"default\"</td>\r\n</tr>\r\n\r\n<tr>\r\n<td>_.get(obj, 'x', 'default')<br>// =&gt; \"default\"</td>\r\n<td>add</td>\r\n<td>_.invoke(obj, 'X', 'default')<br>// =&gt; \"default\"</td>\r\n</tr>\r\n</table>"},"comment":{"url":"https://api.github.com/repos/lodash/lodash/issues/comments/262985562","html_url":"https://github.com/lodash/lodash/issues/2853#issuecomment-262985562","issue_url":"https://api.github.com/repos/lodash/lodash/issues/2853","id":262985562,"user":{"login":"jdalton","id":4303,"avatar_url":"https://avatars.githubusercontent.com/u/4303?v=3","gravatar_id":"","url":"https://api.github.com/users/jdalton","html_url":"https://github.com/jdalton","followers_url":"https://api.github.com/users/jdalton/followers","following_url":"https://api.github.com/users/jdalton/following{/other_user}","gists_url":"https://api.github.com/users/jdalton/gists{/gist_id}","starred_url":"https://api.github.com/users/jdalton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdalton/subscriptions","organizations_url":"https://api.github.com/users/jdalton/orgs","repos_url":"https://api.github.com/users/jdalton/repos","events_url":"https://api.github.com/users/jdalton/events{/privacy}","received_events_url":"https://api.github.com/users/jdalton/received_events","type":"User","site_admin":false},"created_at":"2016-11-25T15:56:23Z","updated_at":"2016-11-25T15:56:23Z","body":"Hi @ArturBaybulatov!\r\n\r\nIt may be better if the result was a default function to invoke and not the default result. \r\n\r\nWe'll keep an eye on [the popularity of the request](https://github.com/lodash/lodash/blob/master/.github/CONTRIBUTING.md#feature-requests)."}}
{"actor":{"display_login":"jdalton"}}