Skip to content

Commit

Permalink
handle null value when masking data
Browse files Browse the repository at this point in the history
  • Loading branch information
TMisiukiewicz committed Oct 3, 2024
1 parent 3e305c3 commit 2790ba4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/libs/ExportOnyxState/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ const maskSessionDetails = (data: Record<string, unknown>): Record<string, unkno
};
};

const maskFragileData = (data: Record<string, unknown> | unknown[], parentKey?: string): Record<string, unknown> | unknown[] => {
const maskFragileData = (data: Record<string, unknown> | unknown[] | null, parentKey?: string): Record<string, unknown> | unknown[] | null => {
if (data === null) {
return data;
}

if (Array.isArray(data)) {
return data.map((item): unknown => (typeof item === 'object' ? maskFragileData(item as Record<string, unknown>, parentKey) : item));
}
Expand Down

0 comments on commit 2790ba4

Please sign in to comment.