dist/js/main.js
/**
   * Fetch a restaurant by its ID.
   */
Fetch a restaurant by its ID.
Fetch a restaurant by its ID .
static fetchRestaurantById(id, callback) {
    DBHelper.fetchRestaurants((error, restaurants) => {
      if (error) {
        callback(error, null);
      } else {
        const restaurant = restaurants.find(r => r.id == id);
        if (restaurant) { 
          callback(null, restaurant);
        } else { 
          callback('Restaurant does not exist', null);
        }
      }
    });
  }
static fetchRestaurantById ( id , callback ) { DBHelper . fetchRestaurants ( ( error , restaurants ) => { if ( error ) { callback ( error , null ) ; } else { const restaurant = restaurants . find ( r => r . id == id ) ; if ( restaurant ) { callback ( null , restaurant ) ; } else { callback ( 'Restaurant does not exist' , null ) ; } } } ) ; }
Fetch a restaurant by its ID.
Fetch a restaurant by its ID .
// fetch all restaurants with proper error handling.
 // Got the restaurant
 // Restaurant does not exist in the database
