All files / app/shipping findLineItems.ts

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15  16x   16x       9x     9x        
import { Cart, Consignment, PhysicalItem } from '@bigcommerce/checkout-sdk';
import { compact, find, map } from 'lodash';
 
export default function findLineItems(
    cart: Cart,
    consignment: Consignment
): PhysicalItem[] {
    return compact(
        map(
            consignment.lineItemIds,
            itemId => find(cart.lineItems.physicalItems , { id: itemId })
        )
    );
}