Skip to content

Commit

Permalink
removing nested object
Browse files Browse the repository at this point in the history
  • Loading branch information
aneuway2 committed Oct 3, 2018
1 parent d633c7b commit d51c898
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions modules/appnexusBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,24 +81,26 @@ export const spec = {
let debugObj = {};
let debugObjParams = {};
const debugCookieName = 'apn_prebid_debug';
const debugCookie = getCookie(debugCookieName) || false;
const debugCookie = getCookie(debugCookieName) || null;

if (debugCookie) {
try {
debugObjParams['debug'] = JSON.parse(debugCookie);
debugObj = JSON.parse(debugCookie);
} catch (e) {
utils.logError('AppNexus Debug Auction Cookie Error:\n\n' + e);
}
} else {
debugObjParams = find(bidRequests, hasDebug);
const debugBidRequest = find(bidRequests, hasDebug);
if (debugBidRequest && debugBidRequest['debug']) {
debugObj = debugBidRequest['debug'];
}
}

if (debugObjParams && debugObjParams.debug) {
Object.keys(debugObjParams.debug)
if (debugObj && debugObj['enabled']) {
Object.keys(debugObj)
.filter(param => includes(DEBUG_PARAMS, param))
.forEach(param => {
debugObj['debug'] = debugObj['debug'] || {};
debugObj.debug[param] = debugObjParams.debug[param]
debugObjParams[param] = debugObj[param];
});
}

Expand All @@ -124,9 +126,9 @@ export const spec = {
payload.app = appIdObj;
}

if (debugObj && debugObj.debug) {
payload.debug = debugObj.debug;
utils.logInfo('AppNexus Debug Auction Settings:\n\n' + JSON.stringify(debugObj.debug, null, 4));
if (debugObjParams && debugObjParams['enabled']) {
payload.debug = debugObjParams;
utils.logInfo('AppNexus Debug Auction Settings:\n\n' + JSON.stringify(debugObjParams, null, 4));
}

if (bidderRequest && bidderRequest.gdprConsent) {
Expand Down

0 comments on commit d51c898

Please sign in to comment.