{"action":"created","issue":{"url":"https://api.github.com/repos/prebid/Prebid.js/issues/143","labels_url":"https://api.github.com/repos/prebid/Prebid.js/issues/143/labels{/name}","comments_url":"https://api.github.com/repos/prebid/Prebid.js/issues/143/comments","events_url":"https://api.github.com/repos/prebid/Prebid.js/issues/143/events","html_url":"https://github.com/prebid/Prebid.js/issues/143","id":123675904,"number":143,"title":"utils.extend() destroys arrays","user":{"login":"BartVB","id":32803,"avatar_url":"https://avatars.githubusercontent.com/u/32803?v=3","gravatar_id":"","url":"https://api.github.com/users/BartVB","html_url":"https://github.com/BartVB","followers_url":"https://api.github.com/users/BartVB/followers","following_url":"https://api.github.com/users/BartVB/following{/other_user}","gists_url":"https://api.github.com/users/BartVB/gists{/gist_id}","starred_url":"https://api.github.com/users/BartVB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BartVB/subscriptions","organizations_url":"https://api.github.com/users/BartVB/orgs","repos_url":"https://api.github.com/users/BartVB/repos","events_url":"https://api.github.com/users/BartVB/events{/privacy}","received_events_url":"https://api.github.com/users/BartVB/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-12-23T15:13:20Z","updated_at":"2016-01-15T03:59:31Z","closed_at":null,"body":"I'm currently implementing Criteo RTA. A part of the implementation is:\r\n\r\n```javascript\r\n    pbjs.bidderSettings = {\r\n        criteo: {\r\n            alwaysUseBid : true,\r\n            adserverTargeting: [{\r\n                key: \"criteo\",\r\n                val: function (bidResponse) {\r\n                    return bidResponse.keys;\r\n                }\r\n            }\r\n            ]\r\n        },\r\n```\r\n\r\nThis should result in [setTargeting(key, value)](https://developers.google.com/doubleclick-gpt/reference?hl=en#googletag.PubAdsService_setTargeting) being called where 'value' is an array of zones which are present in the Criteo cookie.\r\n\r\nAlas this doesn't work because:\r\nhttps://github.com/prebid/Prebid.js/blob/master/src/utils.js#L99\r\n\r\nreplaces the array with an Object. I fixed this by replacing this code with simply:\r\n\r\n```javascript\r\nexports.extend = function(target, source){\r\n\ttarget = target || {};\r\n\r\n\tthis._each(source,function(value,prop){\r\n        \ttarget[prop] = source[prop];\r\n\t});\r\n\treturn target;\r\n};\r\n```\r\n\r\nThis also brings it more into accordance with [Object.assign()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign#Polyfill) where only one level of properties is copied."},"comment":{"url":"https://api.github.com/repos/prebid/Prebid.js/issues/comments/171866464","html_url":"https://github.com/prebid/Prebid.js/issues/143#issuecomment-171866464","issue_url":"https://api.github.com/repos/prebid/Prebid.js/issues/143","id":171866464,"user":{"login":"nickjacob","id":1192267,"avatar_url":"https://avatars.githubusercontent.com/u/1192267?v=3","gravatar_id":"","url":"https://api.github.com/users/nickjacob","html_url":"https://github.com/nickjacob","followers_url":"https://api.github.com/users/nickjacob/followers","following_url":"https://api.github.com/users/nickjacob/following{/other_user}","gists_url":"https://api.github.com/users/nickjacob/gists{/gist_id}","starred_url":"https://api.github.com/users/nickjacob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nickjacob/subscriptions","organizations_url":"https://api.github.com/users/nickjacob/orgs","repos_url":"https://api.github.com/users/nickjacob/repos","events_url":"https://api.github.com/users/nickjacob/events{/privacy}","received_events_url":"https://api.github.com/users/nickjacob/received_events","type":"User","site_admin":false},"created_at":"2016-01-15T03:59:31Z","updated_at":"2016-01-15T03:59:31Z","body":"maybe to avoid any breaking changes/still fix the array issue we could just change line 103 from:\r\n\r\n```javascript\r\n\t\tif (typeof source[prop] === objectType_object) {\r\n```\r\n\r\nto\r\n\r\n```javascript\r\n\t\tif (this.isA(source[prop], 'Object')) {\r\n```\r\n\r\n@BartVB  would that work for criteo?"}}