# The cart module for "Bonus: a test overlay is the module". overlay.sh# pairs it with a cart_test.j that tries to fake parseQty.use convert;
exportdefstruct Line { sku asstring, qty asint };
# parseQty reads a quantity typed by a user; it throws for anything that is# not a whole number.exportfuncparseQty(text asstring) {
returnconvert.toInt($text);
}
exportfuncline(sku asstring, text asstring) {
return Line{sku: $sku, qty: parseQty($text)};
}