// eslint-disable-next-line import/prefer-default-export
export function getLineItemsFlattened(lineItems) {
    return lineItems?.flatMap((li) => [li, ...(getLineItemsFlattened(li.childParts))]) ?? [];
}

export function findLineItemIndex(lineItems, partNumber, startIndex = 0) {
    return lineItems.findIndex((li, index) => index >= startIndex && li.partNumber === partNumber);
}
