Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
serverResponse.bids.forEach(serverBid => {
const requestId = findIndex(bidderRequest.bids, (bidRequest) => {
return bidRequest.bidId === serverBid.requestId;
});
if (serverBid.cpm !== 0 && requestId !== -1) {
const bid = createBid(serverBid, getMediaType(bidderRequest.bids[requestId]));
bids.push(bid);
}
});
adomikAdapter.bucketEvents.forEach(function(typedEvent, i) {
const [placementCode, type] = [typedEvent.event.placementCode, typedEvent.type];
let existTypedEvent = findIndex(groupedTypedEvents, (groupedTypedEvent) => groupedTypedEvent.placementCode === placementCode);
if (existTypedEvent === -1) {
groupedTypedEvents.push({
placementCode: placementCode,
[type]: [typedEvent]
});
existTypedEvent = groupedTypedEvents.length - 1;
}
if (groupedTypedEvents[existTypedEvent][type]) {
groupedTypedEvents[existTypedEvent][type] = [...groupedTypedEvents[existTypedEvent][type], typedEvent];
} else {
groupedTypedEvents[existTypedEvent][type] = [typedEvent];
}
});
serverResponse.bids.forEach(serverBid => {
const requestId = findIndex(bidderRequest.bids, (bidRequest) => {
return bidRequest.bidId === serverBid.requestId;
});
if (serverBid.cpm !== 0 && requestId !== -1) {
const bid = createBid(serverBid, getMediaType(bidderRequest.bids[requestId]));
bids.push(bid);
}
});
const testmode = isTestmode();
const pageurl = getTopWindowUrlEncoded();
const platform = findPlatform(platforms);
const cb = generateUUID();
const search = {
placementids,
adformats,
testmode,
pageurl,
sdk,
adapterver,
platform,
platver,
cb
};
const video = findIndex(adformats, isVideo);
if (video !== -1) {
[search.playerwidth, search.playerheight] = expandSize(sizes[video]);
}
const data = formatQS(search);
return [{ adformats, data, method, requestIds, sizes, url }];
};
nextNodes = updateTopicsInput.topicNames.map((topicName: string) => {
const idx: number = findIndex(repositoryTopics.nodes, node => node.topic.name === topicName);
const exist: boolean = idx !== -1;
if (exist) {
return repositoryTopics.nodes[idx];
} else {
return {
id: Math.random().toString(),
topic: {
id: Math.random().toString(),
name: topicName,
__typename: 'Topic'
},
__typename: 'RepositoryTopic'
};
}
});
}