Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function validateBasket(crystallizeBasket, _opt) {
ow(crystallizeBasket, ow.object);
const { items, coupon } = crystallizeBasket;
ow(items, ow.array);
ow(coupon, ow.any(ow.string, ow.null));
ow(_opt, ow.any(ow.object, ow.undefined));
const options = Object.assign(
{
excludeDiscount: true,
excludeShipping: true
},
_opt
);
let discount = null;
if (items.length === 0) {
return {
success: false,
validatedBasket: {