Handle null or empty on processor

This commit is contained in:
Adria Navarro 2024-05-03 16:21:35 +02:00
parent ab647d1f0f
commit d91292f532
1 changed files with 4 additions and 11 deletions

View File

@ -108,14 +108,9 @@ interface UserReferenceInfo {
} }
export async function processOutputBBReference( export async function processOutputBBReference(
value: string, value: string | null | undefined,
subtype: BBReferenceFieldSubType.USER subtype: BBReferenceFieldSubType.USER
): Promise<UserReferenceInfo | undefined> { ): Promise<UserReferenceInfo | undefined> {
if (value === null || value === undefined) {
// Already processed or nothing to process
return value || undefined
}
if (!value) { if (!value) {
return undefined return undefined
} }
@ -148,14 +143,12 @@ export async function processOutputBBReference(
} }
export async function processOutputBBReferences( export async function processOutputBBReferences(
value: string, value: string | null | undefined,
subtype: BBReferenceFieldSubType subtype: BBReferenceFieldSubType
): Promise<UserReferenceInfo[] | undefined> { ): Promise<UserReferenceInfo[] | undefined> {
if (value === null || value === undefined) { if (!value) {
// Already processed or nothing to process return undefined
return value || undefined
} }
const ids = const ids =
typeof value === "string" ? value.split(",").filter(id => !!id) : value typeof value === "string" ? value.split(",").filter(id => !!id) : value