diff --git a/docs/.vitepress/api-pages.ts b/docs/.vitepress/api-pages.ts index c23e6cfc466..60cd553d98b 100644 --- a/docs/.vitepress/api-pages.ts +++ b/docs/.vitepress/api-pages.ts @@ -18,6 +18,7 @@ export const apiPages = [ { text: 'Datatype', link: '/api/datatype.html' }, { text: 'Date', link: '/api/date.html' }, { text: 'Finance', link: '/api/finance.html' }, + { text: 'Food', link: '/api/food.html' }, { text: 'Git', link: '/api/git.html' }, { text: 'Hacker', link: '/api/hacker.html' }, { text: 'Helpers', link: '/api/helpers.html' }, diff --git a/scripts/generate-locales.ts b/scripts/generate-locales.ts index 4228cc91b3b..c1aea203123 100644 --- a/scripts/generate-locales.ts +++ b/scripts/generate-locales.ts @@ -63,6 +63,7 @@ const definitionsTypes: DefinitionType = { database: 'DatabaseDefinition', date: 'DateDefinition', finance: 'FinanceDefinition', + food: 'FoodDefinition', hacker: 'HackerDefinition', internet: 'InternetDefinition', location: 'LocationDefinition', diff --git a/src/definitions/definitions.ts b/src/definitions/definitions.ts index c2a3b560099..cf760f0bcf0 100644 --- a/src/definitions/definitions.ts +++ b/src/definitions/definitions.ts @@ -6,6 +6,7 @@ import type { CompanyDefinition } from './company'; import type { DatabaseDefinition } from './database'; import type { DateDefinition } from './date'; import type { FinanceDefinition } from './finance'; +import type { FoodDefinition } from './food'; import type { HackerDefinition } from './hacker'; import type { InternetDefinition } from './internet'; import type { LocationDefinition } from './location'; @@ -39,6 +40,7 @@ export type LocaleDefinition = { database?: DatabaseDefinition; date?: DateDefinition; finance?: FinanceDefinition; + food?: FoodDefinition; hacker?: HackerDefinition; internet?: InternetDefinition; location?: LocationDefinition; diff --git a/src/definitions/food.ts b/src/definitions/food.ts new file mode 100644 index 00000000000..99cee8e349c --- /dev/null +++ b/src/definitions/food.ts @@ -0,0 +1,53 @@ +import type { LocaleEntry } from './definitions'; + +export type FoodDefinition = LocaleEntry<{ + /** + * Common food adjectives. + */ + adjective: string[]; + + /** + * List of description patterns. + */ + description_pattern: string[]; + + /** + * Common dish names. + */ + dish: string[]; + + /** + * List of dish patterns. + */ + dish_pattern: string[]; + + /** + * A list of cooking styles that are commonly associated with a particular food item or recipe. + */ + ethnic_category: string[]; + + /** + * A list of common fruit names. + */ + fruit: string[]; + + /** + * Common ingredient names. + */ + ingredient: string[]; + + /** + * Common meat names. + */ + meat: string[]; + + /** + * A list of common spice names. + */ + spice: string[]; + + /** + * A list of common vegetable names. + */ + vegetable: string[]; +}>; diff --git a/src/definitions/index.ts b/src/definitions/index.ts index f101f4ff8bb..cb2401156ac 100644 --- a/src/definitions/index.ts +++ b/src/definitions/index.ts @@ -10,6 +10,7 @@ export type { DatabaseDefinition } from './database'; export type { DateDefinition, DateEntryDefinition } from './date'; export type { LocaleDefinition, LocaleEntry } from './definitions'; export type { FinanceDefinition } from './finance'; +export type { FoodDefinition } from './food'; export type { HackerDefinition } from './hacker'; export type { InternetDefinition } from './internet'; export type { LocationDefinition } from './location'; diff --git a/src/faker.ts b/src/faker.ts index e63b89b3e59..d48350671a8 100644 --- a/src/faker.ts +++ b/src/faker.ts @@ -11,6 +11,7 @@ import { CompanyModule } from './modules/company'; import { DatabaseModule } from './modules/database'; import { DateModule } from './modules/date'; import { FinanceModule } from './modules/finance'; +import { FoodModule } from './modules/food'; import { GitModule } from './modules/git'; import { HackerModule } from './modules/hacker'; import { HelpersModule } from './modules/helpers'; @@ -75,6 +76,7 @@ export class Faker extends SimpleFaker { readonly database: DatabaseModule = new DatabaseModule(this); readonly date: DateModule = new DateModule(this); readonly finance = new FinanceModule(this); + readonly food = new FoodModule(this); readonly git: GitModule = new GitModule(this); readonly hacker: HackerModule = new HackerModule(this); readonly helpers: HelpersModule = new HelpersModule(this); diff --git a/src/index.ts b/src/index.ts index 8a8ffdb7e8e..8dd2982bbb2 100644 --- a/src/index.ts +++ b/src/index.ts @@ -30,6 +30,7 @@ export type { FinanceDefinition, /** @deprecated Use FinanceDefinition instead */ FinanceDefinition as FinanceDefinitions, + FoodDefinition, HackerDefinition, /** @deprecated Use HackerDefinition instead */ HackerDefinition as HackerDefinitions, @@ -101,6 +102,7 @@ export type { DatabaseModule } from './modules/database'; export type { DatatypeModule } from './modules/datatype'; export type { DateModule, SimpleDateModule } from './modules/date'; export type { Currency, FinanceModule } from './modules/finance'; +export type { FoodModule } from './modules/food'; export type { GitModule } from './modules/git'; export type { HackerModule } from './modules/hacker'; export type { HelpersModule, SimpleHelpersModule } from './modules/helpers'; diff --git a/src/locales/en/food/adjective.ts b/src/locales/en/food/adjective.ts new file mode 100644 index 00000000000..e50a9fbdd79 --- /dev/null +++ b/src/locales/en/food/adjective.ts @@ -0,0 +1,22 @@ +export default [ + 'bitter', + 'creamy', + 'crispy', + 'crunchy', + 'delicious', + 'fluffy', + 'fresh', + 'golden', + 'juicy', + 'moist', + 'rich', + 'salty', + 'savory', + 'smoky', + 'sour', + 'spicy', + 'sweet', + 'tangy', + 'tender', + 'zesty', +]; diff --git a/src/locales/en/food/description_pattern.ts b/src/locales/en/food/description_pattern.ts new file mode 100644 index 00000000000..21909d0b4ac --- /dev/null +++ b/src/locales/en/food/description_pattern.ts @@ -0,0 +1,23 @@ +export default [ + 'A classic pie filled with delicious {{food.meat}} and {{food.adjective}} {{food.ingredient}}, baked in a {{food.adjective}} pastry crust and topped with a golden-brown lattice.', + 'A delightful tart combining {{food.adjective}} {{food.vegetable}} and sweet {{food.fruit}}, set in a buttery pastry shell and finished with a hint of {{food.spice}}.', + 'A heartwarming {{food.ethnic_category}} soup, featuring fresh {{food.ingredient}} and an aromatic blend of traditional spices.', + 'A robust {{food.adjective}} stew featuring {{food.ethnic_category}} flavors, loaded with {{food.adjective}} meat, {{food.adjective}} vegetables, and a {{food.adjective}}, {{food.adjective}} broth.', + 'A simple {{food.fruit}} pie. No fancy stuff. Just pie.', + 'A slow-roasted {{animal.bird}} with a {{food.adjective}}, {{food.adjective}} exterior. Stuffed with {{food.fruit}} and covered in {{food.fruit}} sauce. Sides with {{food.vegetable}} puree and wild {{food.vegetable}}.', + 'A special {{color.human}} {{food.ingredient}} from {{location.country}}. To support the strong flavor it is sided with a tablespoon of {{food.spice}}.', + 'A succulent {{food.meat}} steak, encased in a {{food.adjective}} {{food.spice}} crust, served with a side of {{food.spice}} mashed {{food.vegetable}}.', + 'An exquisite {{food.meat}} roast, infused with the essence of {{food.fruit}}, slow-roasted to bring out its natural flavors and served with a side of creamy {{food.vegetable}}', + 'Baked {{food.ingredient}}-stuffed {{food.meat}}, seasoned with {{food.spice}} and {{food.adjective}} herbs, accompanied by roasted {{food.vegetable}} medley.', + 'Crispy fried {{food.meat}} bites, seasoned with {{food.spice}} and served with a tangy {{food.fruit}} dipping sauce.', + 'Fresh mixed greens tossed with {{food.spice}}-rubbed {{food.meat}}, {{food.vegetable}}, and a light dressing.', + 'Fresh {{food.ingredient}} with a pinch of {{food.spice}}, topped by a caramelized {{food.fruit}} with whipped cream', + 'Grilled {{food.meat}} kebabs, marinated in {{food.ethnic_category}} spices and served with a fresh {{food.vegetable}} and {{food.fruit}} salad.', + 'Hearty {{food.ingredient}} and {{food.meat}} stew, slow-cooked with {{food.spice}} and {{food.vegetable}} for a comforting, flavorful meal.', + 'Juicy {{food.meat}}, grilled to your liking and drizzled with a bold {{food.spice}} sauce, served alongside roasted {{food.vegetable}}.', + 'Our {{food.adjective}} {{food.meat}}, slow-cooked to perfection, accompanied by steamed {{food.vegetable}} and a rich, savory gravy.', + 'Tender {{food.meat}} skewers, glazed with a sweet and tangy {{food.fruit}} sauce, served over a bed of fragrant jasmine rice.', + 'Tenderly braised {{food.meat}} in a rich {{food.spice}} and {{food.vegetable}} sauce, served with a side of creamy {{food.vegetable}}.', + 'Three {{food.ingredient}} with {{food.vegetable}}, {{food.vegetable}}, {{food.vegetable}}, {{food.vegetable}} and {{food.ingredient}}. With a side of baked {{food.fruit}}, and your choice of {{food.ingredient}} or {{food.ingredient}}.', + '{{number.int({"min":1, "max":99})}}-day aged {{food.meat}} steak, with choice of {{number.int({"min":2, "max":4})}} sides.', +]; diff --git a/src/locales/en/food/dish.ts b/src/locales/en/food/dish.ts new file mode 100644 index 00000000000..ef544310585 --- /dev/null +++ b/src/locales/en/food/dish.ts @@ -0,0 +1,56 @@ +export default [ + 'California maki', + 'Peking duck', + 'Philadelphia maki', + 'arepas', + 'barbecue ribs', + 'bruschette with tomato', + 'bunny chow', + 'caesar salad', + 'caprese salad', + 'cauliflower penne', + 'cheeseburger', + 'chicken fajitas', + 'chicken milanese', + 'chicken parm', + 'chicken wings', + 'chilli con carne', + 'ebiten maki', + 'fettuccine alfredo', + 'fish and chips', + 'french fries with sausages', + 'french toast', + 'hummus', + 'katsu curry', + 'kebab', + 'lasagne', + 'linguine with clams', + 'massaman curry', + 'meatballs with sauce', + 'mushroom risotto', + 'pappardelle alla bolognese', + 'pasta and beans', + 'pasta carbonara', + 'pasta with tomato and basil', + 'pho', + 'pierogi', + 'pizza', + 'poke', + 'pork belly buns', + 'pork sausage roll', + 'poutine', + 'ricotta stuffed ravioli', + 'risotto with seafood', + 'salmon nigiri', + 'scotch eggs', + 'seafood paella', + 'som tam', + 'souvlaki', + 'stinky tofu', + 'sushi', + 'tacos', + 'teriyaki chicken donburi', + 'tiramisù', + 'tuna sashimi', + 'vegetable soup', +]; diff --git a/src/locales/en/food/dish_pattern.ts b/src/locales/en/food/dish_pattern.ts new file mode 100644 index 00000000000..8bb76038c27 --- /dev/null +++ b/src/locales/en/food/dish_pattern.ts @@ -0,0 +1,17 @@ +export default [ + '{{food.adjective}} {{food.ethnic_category}} stew', + '{{food.adjective}} {{food.meat}} with {{food.vegetable}}', + '{{food.ethnic_category}} {{food.ingredient}} soup', + '{{food.fruit}} and {{food.fruit}} tart', + '{{food.fruit}} pie', + '{{food.fruit}}-glazed {{food.meat}} skewers', + '{{food.fruit}}-infused {{food.meat}} roast', + '{{food.ingredient}} and {{food.meat}} pie', + '{{food.ingredient}}-infused {{food.meat}}', + '{{food.meat}} steak', + '{{food.meat}} with {{food.fruit}} sauce', + '{{food.spice}}-crusted {{food.meat}}', + '{{food.spice}}-rubbed {{food.meat}} salad', + '{{food.vegetable}} salad', + "{{person.first_name}}'s special {{food.ingredient}}", +]; diff --git a/src/locales/en/food/ethnic_category.ts b/src/locales/en/food/ethnic_category.ts new file mode 100644 index 00000000000..50611834808 --- /dev/null +++ b/src/locales/en/food/ethnic_category.ts @@ -0,0 +1,120 @@ +export default [ + 'Ainu', + 'Albanian', + 'American', + 'Andhra', + 'Anglo-Indian', + 'Arab', + 'Argentine', + 'Armenian', + 'Assyrian', + 'Awadhi', + 'Azerbaijani', + 'Balochi', + 'Bangladeshi', + 'Bashkir', + 'Belarusian', + 'Bengali', + 'Berber', + 'Brazilian', + 'British', + 'Buddhist', + 'Bulgarian', + 'Cajun', + 'Cantonese', + 'Caribbean', + 'Chechen', + 'Chinese', + 'Chinese Islamic', + 'Circassian', + 'Crimean Tatar', + 'Cypriot', + 'Czech', + 'Danish', + 'Egyptian', + 'English', + 'Eritrean', + 'Estonian', + 'Ethiopian', + 'Filipino', + 'French', + 'Georgian', + 'German', + 'Goan', + 'Goan Catholic', + 'Greek', + 'Gujarati', + 'Hyderabad', + 'Indian', + 'Indian Chinese', + 'Indian Singaporean', + 'Indonesian', + 'Inuit', + 'Irish', + 'Italian', + 'Italian-American', + 'Jamaican', + 'Japanese', + 'Jewish - Israeli', + 'Karnataka', + 'Kazakh', + 'Keralite', + 'Korean', + 'Kurdish', + 'Laotian', + 'Latvian', + 'Lebanese', + 'Lithuanian', + 'Louisiana Creole', + 'Maharashtrian', + 'Malay', + 'Malaysian Chinese', + 'Malaysian Indian', + 'Mangalorean', + 'Mediterranean', + 'Mennonite', + 'Mexican', + 'Mordovian', + 'Mughal', + 'Native American', + 'Nepalese', + 'New Mexican', + 'Odia', + 'Pakistani', + 'Parsi', + 'Pashtun', + 'Pennsylvania Dutch', + 'Peranakan', + 'Persian', + 'Peruvian', + 'Polish', + 'Portuguese', + 'Punjabi', + 'Québécois', + 'Rajasthani', + 'Romani', + 'Romanian', + 'Russian', + 'Sami', + 'Serbian', + 'Sindhi', + 'Slovak', + 'Slovenian', + 'Somali', + 'South Indian', + 'Soviet', + 'Spanish', + 'Sri Lankan', + 'Taiwanese', + 'Tamil', + 'Tatar', + 'Texan', + 'Thai', + 'Turkish', + 'Udupi', + 'Ukrainian', + 'Vietnamese', + 'Yamal', + 'Zambian', + 'Zanzibari', +]; diff --git a/src/locales/en/food/fruit.ts b/src/locales/en/food/fruit.ts new file mode 100644 index 00000000000..e593a09ff65 --- /dev/null +++ b/src/locales/en/food/fruit.ts @@ -0,0 +1,71 @@ +export default [ + 'apple', + 'apricot', + 'aubergine', + 'avocado', + 'banana', + 'berry', + 'blackberry', + 'blood orange', + 'blueberry', + 'bush tomato', + 'butternut pumpkin', + 'cantaloupe', + 'cavalo', + 'cherry', + 'corella pear', + 'cranberry', + 'cumquat', + 'currant', + 'custard apple', + 'custard apples daikon', + 'date', + 'dragonfruit', + 'dried apricot', + 'elderberry', + 'feijoa', + 'fig', + 'fingerlime', + 'goji berry', + 'grape', + 'grapefruit', + 'guava', + 'honeydew melon', + 'incaberry', + 'jarrahdale pumpkin', + 'juniper berry', + 'kiwi fruit', + 'kiwiberry', + 'lemon', + 'lime', + 'longan', + 'loquat', + 'lychee', + 'mandarin', + 'mango', + 'mangosteen', + 'melon', + 'mulberry', + 'nashi pear', + 'nectarine', + 'olive', + 'orange', + 'papaw', + 'papaya', + 'passionfruit', + 'peache', + 'pear', + 'pineapple', + 'plum', + 'pomegranate', + 'prune', + 'rockmelon', + 'snowpea', + 'sprout', + 'starfruit', + 'strawberry', + 'sultana', + 'tangelo', + 'tomato', + 'watermelon', +]; diff --git a/src/locales/en/food/index.ts b/src/locales/en/food/index.ts new file mode 100644 index 00000000000..65e4b8a870c --- /dev/null +++ b/src/locales/en/food/index.ts @@ -0,0 +1,30 @@ +/* + * This file is automatically generated. + * Run 'pnpm run generate:locales' to update. + */ +import type { FoodDefinition } from '../../..'; +import adjective from './adjective'; +import description_pattern from './description_pattern'; +import dish from './dish'; +import dish_pattern from './dish_pattern'; +import ethnic_category from './ethnic_category'; +import fruit from './fruit'; +import ingredient from './ingredient'; +import meat from './meat'; +import spice from './spice'; +import vegetable from './vegetable'; + +const food: FoodDefinition = { + adjective, + description_pattern, + dish, + dish_pattern, + ethnic_category, + fruit, + ingredient, + meat, + spice, + vegetable, +}; + +export default food; diff --git a/src/locales/en/food/ingredient.ts b/src/locales/en/food/ingredient.ts new file mode 100644 index 00000000000..ba061184475 --- /dev/null +++ b/src/locales/en/food/ingredient.ts @@ -0,0 +1,487 @@ +export default [ + 'achacha', + 'adzuki beans', + 'agar', + 'agave syrup', + 'ajowan seed', + 'albacore tuna', + 'alfalfa', + 'allspice', + 'almond oil', + 'almonds', + 'amaranth', + 'amchur', + 'anchovies', + 'aniseed', + 'annatto seed', + 'apple cider vinegar', + 'apple juice', + 'apple juice concentrate', + 'apples', + 'apricots', + 'arborio rice', + 'arrowroot', + 'artichoke', + 'arugula', + 'asafoetida', + 'asian greens', + 'asian noodles', + 'asparagus', + 'aubergine', + 'avocado', + 'avocado oil', + 'avocado spread', + 'bacon', + 'baking powder', + 'baking soda', + 'balsamic vinegar', + 'bamboo shoots', + 'banana', + 'barberry', + 'barley', + 'barramundi', + 'basil basmati rice', + 'bay leaves', + 'bean shoots', + 'bean sprouts', + 'beans', + 'beef', + 'beef stock', + 'beetroot', + 'berries', + 'besan', + 'black eyed beans', + 'blackberries', + 'blood oranges', + 'blue cheese', + 'blue eye trevalla', + 'blue swimmer crab', + 'blueberries', + 'bocconcini', + 'bok choy', + 'bonito flakes', + 'bonza', + 'borlotti beans', + 'bran', + 'brazil nut', + 'bread', + 'brie', + 'broccoli', + 'broccolini', + 'brown flour', + 'brown mushrooms', + 'brown rice', + 'brown rice vinegar', + 'brussels sprouts', + 'buckwheat', + 'buckwheat flour', + 'buckwheat noodles', + 'bulghur', + 'bush tomato', + 'butter', + 'butter beans', + 'buttermilk', + 'butternut lettuce', + 'butternut pumpkin', + 'cabbage', + 'cacao', + 'cake', + 'calamari', + 'camellia tea oil', + 'camembert', + 'camomile', + 'candle nut', + 'cannellini beans', + 'canola oil', + 'cantaloupe', + 'capers', + 'capsicum', + 'caraway seed', + 'cardamom', + 'carob carrot', + 'carrot', + 'cashews', + 'cassia bark', + 'cauliflower', + 'cavalo', + 'cayenne', + 'celery', + 'celery seed', + 'cheddar', + 'cherries', + 'chestnut', + 'chia seeds', + 'chicken', + 'chicken stock', + 'chickory', + 'chickpea', + 'chilli pepper', + 'chinese cabbage', + 'chinese five spice', + 'chives', + 'choy sum', + 'cinnamon', + 'clams', + 'cloves', + 'cocoa powder', + 'coconut', + 'coconut oil', + 'coconut water', + 'coffee', + 'common cultivated mushrooms', + 'corella pear', + 'coriander leaves', + 'coriander seed', + 'corn oil', + 'corn syrup', + 'corn tortilla', + 'cornichons', + 'cornmeal', + 'cos lettuce', + 'cottage cheese', + 'cous cous', + 'crabs', + 'cranberry', + 'cream', + 'cream cheese', + 'cucumber', + 'cumin', + 'cumquat', + 'currants', + 'curry leaves', + 'curry powder', + 'custard apples', + 'dandelion', + 'dark chocolate', + 'dashi', + 'dates', + 'dill', + 'dragonfruit', + 'dried apricots', + 'dried chinese broccoli', + 'duck', + 'edam', + 'edamame', + 'eggplant', + 'eggs', + 'elderberry', + 'endive', + 'english spinach', + 'enoki mushrooms', + 'extra virgin olive oil', + 'farmed prawns', + 'feijoa', + 'fennel', + 'fennel seeds', + 'fenugreek', + 'feta', + 'figs', + 'file powder', + 'fingerlime', + 'fish sauce', + 'fish stock', + 'flat mushrooms', + 'flathead', + 'flaxseed', + 'flaxseed oil', + 'flounder', + 'flour', + 'freekeh', + 'french eschallots', + 'fresh chillies', + 'fromage blanc', + 'fruit', + 'galangal', + 'garam masala', + 'garlic', + 'goat cheese', + 'goat milk', + 'goji berry', + 'grape seed oil', + 'grapefruit', + 'grapes', + 'green beans', + 'green pepper', + 'green tea', + 'green tea noodles', + 'greenwheat freekeh', + 'gruyere', + 'guava', + 'gula melaka', + 'haloumi', + 'ham', + 'haricot beans', + 'harissa', + 'hazelnut', + 'hijiki', + 'hiramasa kingfish', + 'hokkien noodles', + 'honey', + 'honeydew melon', + 'horseradish', + 'hot smoked salmon', + 'hummus', + 'iceberg lettuce', + 'incaberries', + 'jarrahdale pumpkin', + 'jasmine rice', + 'jelly', + 'jerusalem artichoke', + 'jewfish', + 'jicama', + 'juniper berries', + 'kale', + 'kangaroo', + 'kecap manis', + 'kenchur', + 'kidney beans', + 'kidneys', + 'kiwi berries', + 'kiwi fruit', + 'kohlrabi', + 'kokam', + 'kombu', + 'koshihikari rice', + 'kudzu', + 'kumera', + 'lamb', + 'lavender flowers', + 'leeks', + 'lemon', + 'lemongrass', + 'lentils', + 'lettuce', + 'licorice', + 'lime leaves', + 'limes', + 'liver', + 'lobster', + 'longan', + 'loquats', + 'lotus root', + 'lychees', + 'macadamia nut', + 'macadamia oil', + 'mace', + 'mackerel', + 'mahi mahi', + 'mahlab', + 'malt vinegar', + 'mandarins', + 'mango', + 'mangosteens', + 'maple syrup', + 'margarine', + 'marigold', + 'marjoram', + 'mastic', + 'melon', + 'milk', + 'milk chocolate', + 'mint', + 'miso', + 'molasses', + 'monkfish', + 'morwong', + 'mountain bread', + 'mozzarella', + 'muesli', + 'mulberries', + 'mullet', + 'mung beans', + 'mussels', + 'mustard', + 'mustard seed', + 'nashi pear', + 'nasturtium', + 'nectarines', + 'nori', + 'nutmeg', + 'nutritional yeast', + 'nuts', + 'oat flour', + 'oatmeal', + 'oats', + 'octopus', + 'okra', + 'olive oil', + 'olives', + 'omega spread', + 'onion', + 'oranges', + 'oregano', + 'oyster mushrooms', + 'oyster sauce', + 'oysters', + 'pandanus leaves', + 'papaw', + 'papaya', + 'paprik', + 'parmesan cheese', + 'parrotfish', + 'parsley', + 'parsnip', + 'passionfruit', + 'pasta', + 'peaches', + 'peanuts', + 'pear', + 'pear juice', + 'pears', + 'peas', + 'pecan nut', + 'pecorino', + 'pepitas', + 'peppercorns', + 'peppermint', + 'peppers', + 'persimmon', + 'pine nut', + 'pineapple', + 'pinto beans', + 'pistachio nut', + 'plums', + 'polenta', + 'pomegranate', + 'poppy seed', + 'porcini mushrooms', + 'pork', + 'potato flour', + 'potatoes', + 'provolone', + 'prunes', + 'pumpkin', + 'pumpkin seed', + 'purple carrot', + 'purple rice', + 'quark quinc', + 'quinoa', + 'radicchio', + 'radish', + 'raisin', + 'raspberry', + 'red cabbage', + 'red lentils', + 'red pepper', + 'red wine', + 'red wine vinegar', + 'redfish', + 'rhubarb', + 'rice flour', + 'rice noodles', + 'rice paper', + 'rice syrup', + 'ricemilk', + 'ricotta', + 'rockmelon', + 'rose water', + 'rosemary', + 'rye', + 'rye bread', + 'safflower oil', + 'saffron', + 'sage', + 'sake', + 'salmon', + 'sardines', + 'sausages', + 'scallops', + 'sea salt', + 'semolina', + 'sesame oil', + 'sesame seeds', + 'shark', + 'shiitake mushrooms', + 'silverbeet', + 'slivered almonds', + 'smoked trout', + 'snapper', + 'snowpea sprouts', + 'snowpeas', + 'soba', + 'sour dough bread', + 'soy', + 'soy beans', + 'soy flour', + 'soy milk', + 'soy sauce', + 'soymilk', + 'spearmint', + 'spelt', + 'spelt bread', + 'spinach', + 'spring onions', + 'sprouts', + 'squash', + 'squid', + 'star anise', + 'star fruit', + 'starfruit', + 'stevia', + 'strawberries', + 'sugar', + 'sultanas', + 'sun-dried tomatoes', + 'sunflower oil', + 'sunflower seeds', + 'sweet chilli sauce', + 'sweet potato', + 'swiss chard', + 'swordfish', + 'szechuan pepperberry', + 'tabasco', + 'tahini', + 'taleggio cheese', + 'tamari', + 'tamarillo', + 'tangelo', + 'tapioca', + 'tapioca flour', + 'tarragon', + 'tea', + 'tea oil', + 'tempeh', + 'thyme', + 'tinned', + 'tofu', + 'tom yum', + 'tomatoes', + 'trout', + 'tuna', + 'turkey', + 'turmeric', + 'turnips', + 'unbleached flour', + 'vanilla beans', + 'vegetable oil', + 'vegetable spaghetti', + 'vegetable stock', + 'vermicelli noodles', + 'vinegar', + 'wakame', + 'walnut', + 'warehou', + 'wasabi', + 'water', + 'watercress', + 'watermelon', + 'wattleseed', + 'wheat', + 'wheatgrass juice', + 'white bread', + 'white flour', + 'white rice', + 'white wine', + 'white wine vinegar', + 'whiting wild rice', + 'wholegrain bread', + 'wholemeal', + 'wholewheat flour', + 'william pear', + 'yeast', + 'yellow papaw', + 'yellowtail kingfish', + 'yoghurt', + 'yogurt', + 'zucchini', +]; diff --git a/src/locales/en/food/meat.ts b/src/locales/en/food/meat.ts new file mode 100644 index 00000000000..3645d1d9017 --- /dev/null +++ b/src/locales/en/food/meat.ts @@ -0,0 +1,18 @@ +export default [ + 'beef', + 'chicken', + 'crocodile', + 'duck', + 'emu', + 'goose', + 'kangaroo', + 'lamb', + 'ostrich', + 'pigeon', + 'pork', + 'quail', + 'rabbit', + 'salmon', + 'turkey', + 'venison', +]; diff --git a/src/locales/en/food/spice.ts b/src/locales/en/food/spice.ts new file mode 100644 index 00000000000..f76d8e969f2 --- /dev/null +++ b/src/locales/en/food/spice.ts @@ -0,0 +1,100 @@ +export default [ + 'achiote seed', + 'ajwain seed', + 'ajwan seed', + 'allspice', + 'amchoor', + 'anise', + 'anise star', + 'aniseed', + 'annatto seed', + 'arrowroot', + 'asafoetida', + 'baharat', + 'balti masala', + 'balti stir fry mix', + 'basil', + 'bay leaves', + 'bbq', + 'caraway seed', + 'cardamom', + 'cassia', + 'cayenne pepper', + 'celery', + 'chamomile', + 'chervil', + 'chilli', + 'chilli pepper', + 'chillies', + 'china star', + 'chives', + 'cinnamon', + 'cloves', + 'colombo', + 'coriander', + 'cumin', + 'curly leaf parsley', + 'curry', + 'dhansak', + 'dill', + 'fennel seed', + 'fenugreek', + 'fines herbes', + 'five spice', + 'french lavender', + 'galangal', + 'garam masala', + 'garlic', + 'german chamomile', + 'ginger', + 'green cardamom', + 'herbes de provence', + 'jalfrezi', + 'jerk', + 'kaffir leaves', + 'korma', + 'lavender', + 'lemon grass', + 'lemon pepper', + 'lime leaves', + 'liquorice root', + 'mace', + 'mango', + 'marjoram', + 'methi', + 'mint', + 'mustard', + 'nutmeg', + 'onion seed', + 'orange zest', + 'oregano', + 'paprika', + 'parsley', + 'pepper', + 'peppercorns', + 'pimento', + 'piri piri', + 'poppy seed', + 'pot marjoram', + 'poudre de colombo', + 'ras-el-hanout', + 'rice paper', + 'rogan josh', + 'rose baie', + 'rosemary', + 'saffron', + 'sage', + 'sesame seed', + 'spearmint', + 'sumac', + 'sweet basil', + 'sweet laurel', + 'tagine', + 'tandoori masala', + 'tarragon', + 'thyme', + 'tikka masala', + 'turmeric', + 'vanilla', + 'zahtar', +]; diff --git a/src/locales/en/food/vegetable.ts b/src/locales/en/food/vegetable.ts new file mode 100644 index 00000000000..7e1019cf526 --- /dev/null +++ b/src/locales/en/food/vegetable.ts @@ -0,0 +1,66 @@ +export default [ + 'artichoke', + 'arugula', + 'asian greens', + 'asparagus', + 'bean shoots', + 'bean sprouts', + 'beans', + 'beetroot', + 'bok choy', + 'broccoli', + 'broccolini', + 'brussels sprouts', + 'butternut lettuce', + 'cabbage', + 'capers', + 'carob carrot', + 'carrot', + 'cauliflower', + 'celery', + 'chilli pepper', + 'chinese cabbage', + 'chives', + 'cornichons', + 'cos lettuce', + 'cucumber', + 'dried chinese broccoli', + 'eggplant', + 'endive', + 'english spinach', + 'french eschallots', + 'fresh chillies', + 'garlic', + 'green beans', + 'green pepper', + 'hijiki', + 'iceberg lettuce', + 'jerusalem artichoke', + 'jicama', + 'kale', + 'kohlrabi', + 'leeks', + 'lettuce', + 'okra', + 'onion', + 'parsnip', + 'peas', + 'peppers', + 'potatoes', + 'pumpkin', + 'purple carrot', + 'radicchio', + 'radish', + 'raspberry', + 'red cabbage', + 'red pepper', + 'rhubarb', + 'snowpea sprouts', + 'spinach', + 'squash', + 'sun dried tomatoes', + 'sweet potato', + 'swiss chard', + 'turnips', + 'zucchini', +]; diff --git a/src/locales/en/index.ts b/src/locales/en/index.ts index fc45da1fc4e..e325d91a6d9 100644 --- a/src/locales/en/index.ts +++ b/src/locales/en/index.ts @@ -13,6 +13,7 @@ import company from './company'; import database from './database'; import date from './date'; import finance from './finance'; +import food from './food'; import hacker from './hacker'; import internet from './internet'; import location from './location'; @@ -37,6 +38,7 @@ const en: LocaleDefinition = { database, date, finance, + food, hacker, internet, location, diff --git a/src/modules/food/index.ts b/src/modules/food/index.ts new file mode 100644 index 00000000000..0effaae6bcb --- /dev/null +++ b/src/modules/food/index.ts @@ -0,0 +1,141 @@ +import { ModuleBase } from '../../internal/module-base'; +/** + * Module for generating food-related data. + * + * ### Overview + * + * This module provides methods to generate various food-related information, such as items on a menu. + * To generate the name of a dish, use [`dish()`](https://fakerjs.dev/api/food.html#dish) and to generate a long description for a dish use [`description()`](https://fakerjs.dev/api/food.html#description). Note that these will not correspond with each other. + * You can also generate individual components of a dish such as [spices](https://fakerjs.dev/api/food.html#spice), [vegetables](https://fakerjs.dev/api/food.html#vegetable), [meats](https://fakerjs.dev/api/food.html#meat), [fruits](https://fakerjs.dev/api/food.html#fruit), or generic [ingredients](https://fakerjs.dev/api/food.html#ingredient). + */ +export class FoodModule extends ModuleBase { + /** + * Generates a random dish adjective. + * + * @example + * faker.food.adjective() // 'crispy' + * + * @since 9.0.0 + */ + adjective(): string { + return this.faker.helpers.fake(this.faker.definitions.food.adjective); + } + + /** + * Generates a random dish description. + * + * @example + * faker.food.description() // 'An exquisite ostrich roast, infused with the essence of longan, slow-roasted to bring out its natural flavors and served with a side of creamy red cabbage' + * + * @since 9.0.0 + */ + description(): string { + return this.faker.helpers.fake( + this.faker.definitions.food.description_pattern + ); + } + + /** + * Generates a random dish name. + * + * @example + * faker.food.dish() // 'Tagine-Rubbed Venison Salad' + * + * @since 9.0.0 + */ + dish(): string { + // A 50/50 mix of specific dishes and dish_patterns + const toTitleCase = (s: string) => + s + .split(' ') + .map((w) => w.charAt(0).toUpperCase() + w.slice(1)) + .join(' '); + if (this.faker.datatype.boolean()) { + return toTitleCase( + this.faker.helpers.fake(this.faker.definitions.food.dish_pattern) + ); + } + + return toTitleCase( + this.faker.helpers.arrayElement(this.faker.definitions.food.dish) + ); + } + + /** + * Generates a random food's ethnic category. + * + * @example + * faker.food.ethnicCategory() // 'Italian' + * + * @since 9.0.0 + */ + ethnicCategory(): string { + return this.faker.helpers.arrayElement( + this.faker.definitions.food.ethnic_category + ); + } + + /** + * Generates a random fruit name. + * + * @example + * faker.food.fruit() // 'lemon' + * + * @since 9.0.0 + */ + fruit(): string { + return this.faker.helpers.arrayElement(this.faker.definitions.food.fruit); + } + + /** + * Generates a random ingredient name. + * + * @example + * faker.food.ingredient() // 'butter' + * + * @since 9.0.0 + */ + ingredient(): string { + return this.faker.helpers.arrayElement( + this.faker.definitions.food.ingredient + ); + } + + /** + * Generates a random meat + * + * @example + * faker.food.meat() // 'venison' + * + * @since 9.0.0 + */ + meat(): string { + return this.faker.helpers.arrayElement(this.faker.definitions.food.meat); + } + + /** + * Generates a random spice name. + * + * @example + * faker.food.spice() // 'chilli' + * + * @since 9.0.0 + */ + spice(): string { + return this.faker.helpers.arrayElement(this.faker.definitions.food.spice); + } + + /** + * Generates a random vegetable name. + * + * @example + * faker.food.vegetable() // 'broccoli' + * + * @since 9.0.0 + */ + vegetable(): string { + return this.faker.helpers.arrayElement( + this.faker.definitions.food.vegetable + ); + } +} diff --git a/test/modules/__snapshots__/food.spec.ts.snap b/test/modules/__snapshots__/food.spec.ts.snap new file mode 100644 index 00000000000..5c3b894e44a --- /dev/null +++ b/test/modules/__snapshots__/food.spec.ts.snap @@ -0,0 +1,55 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`food > 42 > adjective 1`] = `"golden"`; + +exports[`food > 42 > description 1`] = `"A succulent venison steak, encased in a sour liquorice root crust, served with a side of bay leaves mashed broccoli."`; + +exports[`food > 42 > dish 1`] = `"Caraway Seed-crusted Rabbit"`; + +exports[`food > 42 > ethnicCategory 1`] = `"Gujarati"`; + +exports[`food > 42 > fruit 1`] = `"fig"`; + +exports[`food > 42 > ingredient 1`] = `"flat mushrooms"`; + +exports[`food > 42 > meat 1`] = `"goose"`; + +exports[`food > 42 > spice 1`] = `"dhansak"`; + +exports[`food > 42 > vegetable 1`] = `"cos lettuce"`; + +exports[`food > 1211 > adjective 1`] = `"tender"`; + +exports[`food > 1211 > description 1`] = `"Three tamari with capers, zucchini, onion, onion and rice paper. With a side of baked feijoa, and your choice of persimmon or slivered almonds."`; + +exports[`food > 1211 > dish 1`] = `"Lasagne"`; + +exports[`food > 1211 > ethnicCategory 1`] = `"Texan"`; + +exports[`food > 1211 > fruit 1`] = `"strawberry"`; + +exports[`food > 1211 > ingredient 1`] = `"turmeric"`; + +exports[`food > 1211 > meat 1`] = `"turkey"`; + +exports[`food > 1211 > spice 1`] = `"tagine"`; + +exports[`food > 1211 > vegetable 1`] = `"sun dried tomatoes"`; + +exports[`food > 1337 > adjective 1`] = `"fluffy"`; + +exports[`food > 1337 > description 1`] = `"A slow-roasted White-winged Scoter with a fluffy, moist exterior. Stuffed with dried apricot and covered in kiwi fruit sauce. Sides with carrot puree and wild turnips."`; + +exports[`food > 1337 > dish 1`] = `"Cauliflower-infused Ostrich"`; + +exports[`food > 1337 > ethnicCategory 1`] = `"Czech"`; + +exports[`food > 1337 > fruit 1`] = `"custard apple"`; + +exports[`food > 1337 > ingredient 1`] = `"coconut water"`; + +exports[`food > 1337 > meat 1`] = `"emu"`; + +exports[`food > 1337 > spice 1`] = `"chilli pepper"`; + +exports[`food > 1337 > vegetable 1`] = `"carrot"`; diff --git a/test/modules/food.spec.ts b/test/modules/food.spec.ts new file mode 100644 index 00000000000..473a191b1c5 --- /dev/null +++ b/test/modules/food.spec.ts @@ -0,0 +1,89 @@ +import { describe, expect, it } from 'vitest'; +import { faker } from '../../src'; +import { seededTests } from '../support/seeded-runs'; +import { times } from './../support/times'; + +const NON_SEEDED_BASED_RUN = 5; + +describe('food', () => { + seededTests(faker, 'food', (t) => { + t.it('adjective'); + + t.it('description'); + + t.it('dish'); + + t.it('ethnicCategory'); + + t.it('fruit'); + + t.it('ingredient'); + + t.it('meat'); + + t.it('spice'); + + t.it('vegetable'); + }); + + describe.each(times(NON_SEEDED_BASED_RUN).map(() => faker.seed()))( + 'random seeded tests for seed %i', + () => { + describe('adjective', () => { + it(`should return random value from adjective array`, () => { + const actual = faker.food.adjective(); + expect(faker.definitions.food.adjective).toContain(actual); + }); + }); + + describe('dish', () => { + it(`should be a capitalized string`, () => { + const actual = faker.food.dish(); + expect(actual[0]).toBe(actual[0].toUpperCase()); + }); + }); + + describe('ethnicCategory', () => { + it(`should return random value from ethnic_category array`, () => { + const actual = faker.food.ethnicCategory(); + expect(faker.definitions.food.ethnic_category).toContain(actual); + }); + }); + + describe('fruit', () => { + it(`should return random value from fruit array`, () => { + const actual = faker.food.fruit(); + expect(faker.definitions.food.fruit).toContain(actual); + }); + }); + + describe('ingredient', () => { + it(`should return random value from ingredient array`, () => { + const actual = faker.food.ingredient(); + expect(faker.definitions.food.ingredient).toContain(actual); + }); + }); + + describe('meat', () => { + it(`should return random value from meat array`, () => { + const actual = faker.food.meat(); + expect(faker.definitions.food.meat).toContain(actual); + }); + }); + + describe('spice', () => { + it(`should return random value from spice array`, () => { + const actual = faker.food.spice(); + expect(faker.definitions.food.spice).toContain(actual); + }); + }); + + describe('vegetable', () => { + it(`should return random value from vegetable array`, () => { + const actual = faker.food.vegetable(); + expect(faker.definitions.food.vegetable).toContain(actual); + }); + }); + } + ); +});