message: Refactor from pormise to async
diff: @@ -52,10 +52,8 @@ type UpsShipmentOutput = {
  }
  // return a promise with the output object for a shipment
  -export function get_ups_shipment(ups:UpsAPI, trackingNumber: string): Promise<UpsShipmentOutput> {
  - return new Promise((resolve, reject) => {
  - ups_track(ups, trackingNumber)
  - .then((res: UpsResponse) => {
  +export async function get_ups_shipment(ups:UpsAPI, trackingNumber: string): Promise<UpsShipmentOutput> {
  + let res = await ups_track(ups, trackingNumber);
  const isGround = is_ground(res);
  const output: Output = { ups: res };
  const result = { trackingNumber, output };
  @@ -75,25 +73,14 @@ export function get_ups_shipment(ups:UpsAPI, trackingNumber: string): Promise<Up
  if (path) {
  output.from = path.from;
  output.to = path.to;
  - calc_distance(path.from, path.to, isGround ? 'ground' : 'air').then((distance) => {
  + const distance = await calc_distance(path.from, path.to, isGround ? 'ground' : 'air');
  output.distance = distance;
  - calc_freight_emissions(weight, distance).then(emissions=>{
  + const emissions = await calc_freight_emissions(weight, distance);
  output.emissions = emissions;
  - resolve(result);
  - }).catch(error => {
  - reject({trackingNumber, error});
  - });
  - }).catch(error => {
  - reject({trackingNumber, error});
  - });
  + return result;
  } else {
  - reject({trackingNumber, error: 'Package not delivered yet!'});
  + throw new Error('Package not delivered yet!');
  }
  - })
  - .catch(error => {
  - reject({trackingNumber, error});
  - })
  - });
  }
  