modules/consentManagement.js
function processCmpData(consentObject, hookConfig) {
  let gdprApplies = consentObject && consentObject.getConsentData && consentObject.getConsentData.gdprApplies;
  if (
    (typeof gdprApplies !== 'boolean') ||
    (gdprApplies === true &&
      !(utils.isStr(consentObject.getConsentData.consentData) &&
        utils.isPlainObject(consentObject.getVendorConsents) &&
        Object.keys(consentObject.getVendorConsents).length > 1
      )
    )
  ) {
    cmpFailed(`CMP returned unexpected value during lookup process.`, hookConfig, consentObject);
  } else {
    clearTimeout(hookConfig.timer);
    storeConsentData(consentObject);

    exitModule(null, hookConfig);
  }
}
function processCmpData(consentObject, hookConfig) {
  let gdprApplies = consentObject && consentObject.getConsentData && consentObject.getConsentData.gdprApplies;
  if (
    (typeof gdprApplies !== 'boolean') ||
    (gdprApplies === true &&
      !(utils.isStr(consentObject.getConsentData.consentData) &&
        utils.isPlainObject(consentObject.getVendorConsents) &&
        Object.keys(consentObject.getVendorConsents).length > 1
      )
    )
  ) {
    cmpFailed(`CMP returned unexpected value during lookup process.`, hookConfig, consentObject);
  } else {
    clearTimeout(hookConfig.timer);
    storeConsentData(consentObject);

    exitModule(null, hookConfig);
  }
}
function processCmpData ( consentObject , hookConfig ) { let gdprApplies = consentObject && consentObject . getConsentData && consentObject . getConsentData . gdprApplies ; if ( ( typeof gdprApplies !== 'boolean' ) || ( gdprApplies === true && ! ( utils . isStr ( consentObject . getConsentData . consentData ) && utils . isPlainObject ( consentObject . getVendorConsents ) && Object . keys ( consentObject . getVendorConsents ) . length > 1 ) ) ) { cmpFailed ( ` ` , hookConfig , consentObject ) ; } else { clearTimeout ( hookConfig . timer ) ; storeConsentData ( consentObject ) ; exitModule ( null , hookConfig ) ; } }
This function checks the consent data provided by CMP to ensure it's in an expected state.
If it's bad, we exit the module depending on config settings.
If it's good, then we store the value and exits the module.
@param {object} consentObject required; object returned by CMP that contains user's consent choices
@param {object} hookConfig contains module related variables (see comment in requestBidsHook function)
This function checks the consent data provided by CMP to ensure it s in an expected state . If it s bad we exit the module depending on config settings . If it s good then we store the value and exits the module .