UNPKG

b-b-calculations

Version:

A cart calculation engine for buffalo burger restaurants

24 lines 832 B
import { CartTotalsResults, Isumcart } from '../models/CartTotals'; /** * Calculates the sum of net prices and total prices for a list of cart items. * * @param {Isumcart[]} items - Array of items, each containing: * - `netPrice`: Net price for the item * - `totalPrice`: Total price for the item including VAT * * @returns {CartTotalsResults} Object containing: * - `itemsNetPrice`: Sum of all net prices * - `itemsTotalPrice`: Sum of all total prices * * @example * const cartItems = [ * { netPrice: 100, totalPrice: 114 }, * { netPrice: 50, totalPrice: 57 } * ]; * * const totals = sumCart(cartItems); * console.log(totals); * // output { itemsTotalPrice: 171, itemsNetPrice: 150 } */ export declare function sumCart(items: Isumcart[]): CartTotalsResults; //# sourceMappingURL=cart-totals.d.ts.map