Skip to content

Commit 00ec121

Browse files
committed
refactor: use explicit loop for denylist filtering
1 parent 8450d87 commit 00ec121

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

src/Rokt-Kit.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -469,14 +469,18 @@ function isSelectPlacementsAttributePersistenceDenied(key: string): boolean {
469469
function removeSelectPlacementsAttributePersistenceDeniedAttributes(
470470
attributes: Record<string, unknown> | null | undefined,
471471
): Record<string, unknown> {
472+
const filteredAttributes: Record<string, unknown> = {};
472473
const sourceAttributes = attributes || {};
474+
const attributeKeys = Object.keys(sourceAttributes);
473475

474-
return Object.entries(sourceAttributes).reduce((filteredAttributes: Record<string, unknown>, [key, value]) => {
476+
for (let i = 0; i < attributeKeys.length; i++) {
477+
const key = attributeKeys[i];
475478
if (!isSelectPlacementsAttributePersistenceDenied(key)) {
476-
filteredAttributes[key] = value;
479+
filteredAttributes[key] = sourceAttributes[key];
477480
}
478-
return filteredAttributes;
479-
}, {});
481+
}
482+
483+
return filteredAttributes;
480484
}
481485

482486
function generateIntegrationName(customIntegrationName?: string): string {

0 commit comments

Comments
 (0)