app/scripts/dbhelper.js
/**
   * Fetch all cuisines with proper error handling.
   */
Fetch all cuisines with proper error handling.
Fetch all cuisines with proper error handling .
static fetchCuisines(callback) {
    DBHelper.fetchRestaurants((error, restaurants) => {
      if (error) {
        callback(error, null);
      } else {
        const cuisines = restaurants.map((v, i) => restaurants[i].cuisine_type);
        const uniqueCuisines = cuisines.filter((v, i) => cuisines.indexOf(v) == i);
        callback(null, uniqueCuisines);
      }
    });
  }
static fetchCuisines ( callback ) { DBHelper . fetchRestaurants ( ( error , restaurants ) => { if ( error ) { callback ( error , null ) ; } else { const cuisines = restaurants . map ( ( v , i ) => restaurants [ i ] . cuisine_type ) ; const uniqueCuisines = cuisines . filter ( ( v , i ) => cuisines . indexOf ( v ) == i ) ; callback ( null , uniqueCuisines ) ; } } ) ; }
Fetch all cuisines with proper error handling.
Fetch all cuisines with proper error handling .
// Fetch all restaurants // Get all cuisines from all restaurants // Remove duplicates from cuisines