{"action":"created","issue":{"url":"https://api.github.com/repos/lodash/lodash/issues/3702","repository_url":"https://api.github.com/repos/lodash/lodash","labels_url":"https://api.github.com/repos/lodash/lodash/issues/3702/labels{/name}","comments_url":"https://api.github.com/repos/lodash/lodash/issues/3702/comments","events_url":"https://api.github.com/repos/lodash/lodash/issues/3702/events","html_url":"https://github.com/lodash/lodash/issues/3702","id":307735444,"number":3702,"title":"_.defaultsDeep and arrays with different lengths","user":{"login":"mukundgoel","id":10262447,"avatar_url":"https://avatars0.githubusercontent.com/u/10262447?v=4","gravatar_id":"","url":"https://api.github.com/users/mukundgoel","html_url":"https://github.com/mukundgoel","followers_url":"https://api.github.com/users/mukundgoel/followers","following_url":"https://api.github.com/users/mukundgoel/following{/other_user}","gists_url":"https://api.github.com/users/mukundgoel/gists{/gist_id}","starred_url":"https://api.github.com/users/mukundgoel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mukundgoel/subscriptions","organizations_url":"https://api.github.com/users/mukundgoel/orgs","repos_url":"https://api.github.com/users/mukundgoel/repos","events_url":"https://api.github.com/users/mukundgoel/events{/privacy}","received_events_url":"https://api.github.com/users/mukundgoel/received_events","type":"User","site_admin":false},"labels":[{"id":2763156,"url":"https://api.github.com/repos/lodash/lodash/labels/question","name":"question","color":"d4c5f9","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-03-22T17:09:32Z","updated_at":"2018-03-22T18:57:50Z","closed_at":"2018-03-22T17:29:42Z","author_association":"NONE","body":"Hi Lodash team!\r\n\r\nI had a question on how _.defaultsDeep works using arrays with different lengths.\r\n\r\nLodash version - 4.17.5 (latest)\r\n\r\nFor example\r\n\r\n------------------------------------------------------------------------------------------\r\n\r\n**code snippet 1:**\r\n`_.defaultsDeep({\r\n    sources: [\"a\"],\r\n    test: {\r\n        abcd: [\"abc\"]\r\n    }\r\n}, {\r\n    sources: [\"a\", \"b\"],\r\n    test: {\r\n        abcd: [\"abc\", \"defa\"]\r\n    }\r\n});`\r\n\r\noutputs `{sources: [\"a\", \"b\"], test: { abcd: [\"abc\", \"defa\"] } }`\r\n\r\nnote: here both source and default array had the **different** lengths\r\n\r\n------------------------------------------------------------------------------------------\r\n\r\n**code snippet 2:**\r\n`_.defaultsDeep({sources: [\"a\"], test: { abcd: [\"abc\", \"cde\"] } }, {sources: [\"b\"], test: { abcd: [\"abc\", \"defa\"] } });`\r\n\r\noutputs `{sources: [\"a\"], test: { abcd: [\"abc\", \"cde\"] } }`\r\n\r\nnote: here both source and default array had the **same** length\r\n\r\n------------------------------------------------------------------------------------------\r\n\r\nThe observation is if both the arrays are not of the same length, lodash is overriding with the defaults, but if arrays are of the same length, the defaults are not being assigned.\r\n\r\nFor code snippet 1, the expected output was `{sources: [\"a\"], test: { abcd: [\"abc\"] } }``.\r\n\r\nThanks for any help!"},"comment":{"url":"https://api.github.com/repos/lodash/lodash/issues/comments/375420686","html_url":"https://github.com/lodash/lodash/issues/3702#issuecomment-375420686","issue_url":"https://api.github.com/repos/lodash/lodash/issues/3702","id":375420686,"user":{"login":"jdalton","id":4303,"avatar_url":"https://avatars2.githubusercontent.com/u/4303?v=4","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":"2018-03-22T18:57:50Z","updated_at":"2018-03-22T18:57:50Z","author_association":"OWNER","body":"It's a side effect of the fact that the length of an array affects what indexed values are available."}}
{"actor":{"display_login":"jdalton"}}