JSPM

  • Created
  • Published
  • Downloads 130
  • Score
    100M100P100Q124153F
  • License ISC

Chiper Inc Ecommerce Lib

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@chiper-inc/ecommerce-lib) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    ecommerce lib

    Features

    • Type base Shop Cart
    • Calculate total and subtotal of a Cart

    Installing

    $ npm install ecommerce-lib

    Example

    // for v3 payload
    const cart = Cart.fromShopCart(data.json);
    // or for v4 payload
    const cart = Cart.from(data.json);
    
    cart.items[1].quanitty = 5;
    
    const total = cart.getTotal();
    const subtotal = cart.getSubtotal();
    

    Publish

    npm install
    npm run build
    npm login
    npm publish