Null coalesce

This commit is contained in:
Chloe Herd 2023-07-12 09:16:43 -04:00
parent fd02085b10
commit 56521c2744

View file

@ -4,11 +4,11 @@ import { packageNames } from "@/constants/package-names";
export function containsLineItemWithPartType(typeToFind, itemsToSearch) {
const partTypeMatches = findLineItemsWithPartType(typeToFind, itemsToSearch);
return !!partTypeMatches.length;
return !!partTypeMatches?.length;
}
export function findLineItemsWithPartType(typeToFind, itemsToSearch) {
const partTypeMatches = itemsToSearch.filter(
const partTypeMatches = itemsToSearch?.filter(
(lineItem) => lineItem.partType.toUpperCase() === typeToFind.toUpperCase()
);