diff --git a/src/adapters/adkernel.js b/src/adapters/adkernel.js index b3383f44e9b..40a7c5abff9 100644 --- a/src/adapters/adkernel.js +++ b/src/adapters/adkernel.js @@ -176,7 +176,7 @@ const AdKernelAdapter = function AdKernelAdapter() { * Create bid object for the bid manager */ function createBidObject(resp, bid, width, height) { - return utils.extend(bidfactory.createBid(1, bid), { + return Object.assign(bidfactory.createBid(1, bid), { bidderCode: bid.bidder, ad: formatAdMarkup(resp), width: width, @@ -189,7 +189,7 @@ const AdKernelAdapter = function AdKernelAdapter() { * Create empty bid object for the bid manager */ function createEmptyBidObject(bid) { - return utils.extend(bidfactory.createBid(2, bid), { + return Object.assign(bidfactory.createBid(2, bid), { bidderCode: bid.bidder }); } diff --git a/src/adapters/analytics/example2.js b/src/adapters/analytics/example2.js index 5e5c0dfc197..b9586b5c59a 100644 --- a/src/adapters/analytics/example2.js +++ b/src/adapters/analytics/example2.js @@ -5,12 +5,11 @@ import { ajax } from 'src/ajax'; */ import adapter from 'AnalyticsAdapter'; -const utils = require('../../utils'); const url = 'https://httpbin.org/post'; const analyticsType = 'endpoint'; -export default utils.extend(adapter( +export default Object.assign(adapter( { url, analyticsType diff --git a/src/adapters/analytics/roxot.js b/src/adapters/analytics/roxot.js index e00ef05c20f..2b71dda84db 100644 --- a/src/adapters/analytics/roxot.js +++ b/src/adapters/analytics/roxot.js @@ -6,7 +6,7 @@ const utils = require('../../utils'); const url = '//d.rxthdr.com/analytics'; const analyticsType = 'endpoint'; -export default utils.extend(adapter( +export default Object.assign(adapter( { url, analyticsType diff --git a/src/adapters/analytics/sharethrough_analytics.js b/src/adapters/analytics/sharethrough_analytics.js index 6b4f9297346..6eadcbcf60c 100644 --- a/src/adapters/analytics/sharethrough_analytics.js +++ b/src/adapters/analytics/sharethrough_analytics.js @@ -6,7 +6,7 @@ const analyticsType = 'endpoint'; const STR_BIDDER_CODE = "sharethrough"; const STR_VERSION = "0.1.0"; -export default utils.extend(adapter( +export default Object.assign(adapter( { emptyUrl, analyticsType diff --git a/src/adapters/appnexus.js b/src/adapters/appnexus.js index 4e60c01826a..0a3b8f7284b 100644 --- a/src/adapters/appnexus.js +++ b/src/adapters/appnexus.js @@ -98,7 +98,7 @@ AppNexusAdapter = function AppNexusAdapter() { } //append custom attributes: - var paramsCopy = utils.extend({}, bid.params); + var paramsCopy = Object.assign({}, bid.params); //delete attributes already used delete paramsCopy.placementId; diff --git a/src/adapters/xhb.js b/src/adapters/xhb.js index be51e257cfd..2b00844e2a1 100644 --- a/src/adapters/xhb.js +++ b/src/adapters/xhb.js @@ -69,7 +69,7 @@ const XhbAdapter = function XhbAdapter() { } //append custom attributes: - let paramsCopy = utils.extend({}, bid.params); + let paramsCopy = Object.assign({}, bid.params); //delete attributes already used delete paramsCopy.placementId; diff --git a/src/bidmanager.js b/src/bidmanager.js index 69eed14c7c4..fc3092d200a 100644 --- a/src/bidmanager.js +++ b/src/bidmanager.js @@ -342,7 +342,7 @@ function adjustBids(bid) { if (code && $$PREBID_GLOBAL$$.bidderSettings && $$PREBID_GLOBAL$$.bidderSettings[code]) { if (typeof $$PREBID_GLOBAL$$.bidderSettings[code].bidCpmAdjustment === objectType_function) { try { - bidPriceAdjusted = $$PREBID_GLOBAL$$.bidderSettings[code].bidCpmAdjustment.call(null, bid.cpm, utils.extend({}, bid)); + bidPriceAdjusted = $$PREBID_GLOBAL$$.bidderSettings[code].bidCpmAdjustment.call(null, bid.cpm, Object.assign({}, bid)); } catch (e) { utils.logError('Error during bid adjustment', 'bidmanager.js', e); diff --git a/src/events.js b/src/events.js index ec196b21c58..2b52de1c38f 100644 --- a/src/events.js +++ b/src/events.js @@ -142,7 +142,7 @@ module.exports = (function () { _public.getEvents = function () { var arrayCopy = []; utils._each(eventsFired, function (value) { - var newProp = utils.extend({}, value); + var newProp = Object.assign({}, value); arrayCopy.push(newProp); }); diff --git a/src/utils.js b/src/utils.js index 71ebd1cb936..b9ec9d5f241 100644 --- a/src/utils.js +++ b/src/utils.js @@ -109,22 +109,6 @@ exports.transformAdServerTargetingObj = function (targeting) { } }; -//Copy all of the properties in the source objects over to the target object -//return the target object. -exports.extend = function (target, source) { - target = target || {}; - - this._each(source, function (value, prop) { - if (typeof source[prop] === objectType_object) { - target[prop] = this.extend(target[prop], source[prop]); - } else { - target[prop] = source[prop]; - } - }); - - return target; -}; - /** * Parse a GPT-Style general size Array like `[[300, 250]]` or `"300x250,970x90"` into an array of sizes `["300x250"]` or '['300x250', '970x90']' * @param {array[array|number]} sizeObj Input array or double array [300,250] or [[300,250], [728,90]] diff --git a/test/spec/adapters/lifestreet_spec.js b/test/spec/adapters/lifestreet_spec.js index 3ae2b6add2f..3f01d1e7fcb 100644 --- a/test/spec/adapters/lifestreet_spec.js +++ b/test/spec/adapters/lifestreet_spec.js @@ -1,9 +1,12 @@ import {expect} from 'chai'; import adloader from 'src/adloader'; import bidmanager from 'src/bidmanager'; -import * as utils from 'src/utils'; import LifestreetAdapter from 'src/adapters/lifestreet'; +function copy(obj) { + return JSON.parse(JSON.stringify(obj)); +} + const BIDDER_REQUEST = { auctionStart: new Date().getTime(), bidderCode: 'lifestreet', @@ -44,7 +47,7 @@ describe ('LifestreetAdapter', () => { beforeEach(() => { tagRequests = []; - request = utils.extend(request, BIDDER_REQUEST); + request = copy(BIDDER_REQUEST); sinon.stub(adloader, 'loadScript', (url, callback) => { tagRequests.push(url); callback(); diff --git a/test/spec/utils_spec.js b/test/spec/utils_spec.js index 118109c3971..faa7aaae13a 100755 --- a/test/spec/utils_spec.js +++ b/test/spec/utils_spec.js @@ -130,7 +130,7 @@ describe('Utils', function () { c:'3' }; - var output = utils.extend(target, source); + var output = Object.assign(target, source); assert.deepEqual(output, expectedResult); }); @@ -140,7 +140,7 @@ describe('Utils', function () { c:'3' }; - var output = utils.extend(target, source); + var output = Object.assign(target, source); assert.deepEqual(output, source); }); @@ -151,7 +151,7 @@ describe('Utils', function () { }; var source = {}; - var output = utils.extend(target, source); + var output = Object.assign(target, source); assert.deepEqual(output, target); }); });