Skip to content

Commit

Permalink
return null of empty object
Browse files Browse the repository at this point in the history
  • Loading branch information
tcm390 committed Feb 6, 2025
1 parent 9ab48ff commit 6a5e9a3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/core/src/parsing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ export function extractAttributes(
attributesToExtract?: string[]
): { [key: string]: string | undefined } {
response = response.trim();
const attributes: { [key: string]: string | undefined } = null;
const attributes: { [key: string]: string | undefined } = {};

if (!attributesToExtract || attributesToExtract.length === 0) {
// Extract all attributes if no specific attributes are provided
Expand All @@ -216,7 +216,7 @@ export function extractAttributes(
});
}

return attributes;
return Object.entries(attributes).length > 0 ? attributes : null;
}

/**
Expand Down

0 comments on commit 6a5e9a3

Please sign in to comment.