Skip to content

Better handling of comma-delimited BA IDs#30

Merged
jmgasper merged 1 commit intomasterfrom
develop
Nov 28, 2025
Merged

Better handling of comma-delimited BA IDs#30
jmgasper merged 1 commit intomasterfrom
develop

Conversation

@jmgasper
Copy link
Collaborator

No description provided.

@jmgasper jmgasper merged commit f24738e into master Nov 28, 2025
4 of 5 checks passed
export function transformArray({ value }: { value: string }) {
return Array.isArray(value) ? value : [value];
export function transformArray({ value }: { value: unknown }) {
if (value === undefined || value === null) return undefined;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[⚠️ correctness]
Returning undefined when value is undefined or null may lead to unexpected behavior if the caller expects an array. Consider returning an empty array instead to maintain consistent return types.

return [v];
};

return Array.isArray(value) ? value.flatMap(splitIfString) : splitIfString(value);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[💡 design]
Using flatMap here is efficient for flattening arrays, but ensure that the caller is aware that nested arrays will be flattened, which might not be the intended behavior if the input is expected to be a single-level array.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant