Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PBjs Core : clean up utils.js #10441

Merged
merged 24 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
adUnitsFilter
  • Loading branch information
dgirardi committed Sep 6, 2023
commit 2e153adcc557c08008d25970d23c1d54fe9e18d3
4 changes: 1 addition & 3 deletions src/auction.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
*/

import {
adUnitsFilter,
deepAccess,
flatten,
generateUUID,
Expand Down Expand Up @@ -212,9 +211,8 @@ export function newAuction({adUnits, adUnitCodes, callback, cbTimeout, labels, a
bidsBackCallback(_adUnits, function () {
try {
if (_callback != null) {
const adUnitCodes = _adUnitCodes;
const bids = _bidsReceived
.filter(adUnitsFilter.bind(this, adUnitCodes))
.filter(bid => _adUnitCodes.includes(bid.adUnitCode))
.reduce(groupByPlacement, {});
_callback.apply(pbjsInstance, [bids, timedOut, _auctionId]);
_callback = null;
Expand Down
3 changes: 1 addition & 2 deletions src/prebid.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import {getGlobal} from './prebidGlobal.js';
import {
adUnitsFilter,
callBurl,
createInvisibleIframe,
deepAccess,
Expand Down Expand Up @@ -336,7 +335,7 @@ pbjsInstance.getConsentMetadata = function () {

function getBids(type) {
const responses = auctionManager[type]()
.filter(adUnitsFilter.bind(this, auctionManager.getAdUnitCodes()))
.filter(bid => auctionManager.getAdUnitCodes().includes(bid.adUnitCode))

// find the last auction id to get responses for most recent auction only
const currentAuctionId = auctionManager.getLastAuctionId();
Expand Down
4 changes: 0 additions & 4 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -627,10 +627,6 @@ export function shuffle(array) {
return array;
}

export function adUnitsFilter(filter, bid) {
return includes(filter, bid && bid.adUnitCode);
}

export function deepClone(obj) {
return clone(obj);
}
Expand Down