aboutsummaryrefslogtreecommitdiff
path: root/src/modules/food
diff options
context:
space:
mode:
authorST-DDT <[email protected]>2024-11-14 22:50:04 +0100
committerGitHub <[email protected]>2024-11-14 21:50:04 +0000
commit188309a59cfe6fbd33e120dedf3bdfef3276d641 (patch)
tree079d062e07065b11ae0bcf8c8cb964174a842080 /src/modules/food
parenta54c1edb87e88b198966d248d5273c9898c32798 (diff)
downloadfaker-188309a59cfe6fbd33e120dedf3bdfef3276d641.tar.xz
faker-188309a59cfe6fbd33e120dedf3bdfef3276d641.zip
infra(unicorn): consistent-function-scoping (#3255)
Diffstat (limited to 'src/modules/food')
-rw-r--r--src/modules/food/index.ts18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/modules/food/index.ts b/src/modules/food/index.ts
index 45b91f30..8dd77741 100644
--- a/src/modules/food/index.ts
+++ b/src/modules/food/index.ts
@@ -1,4 +1,17 @@
import { ModuleBase } from '../../internal/module-base';
+
+/**
+ * Converts the given string to title case.
+ *
+ * @param text The text to convert.
+ */
+function toTitleCase(text: string): string {
+ return text
+ .split(' ')
+ .map((word) => word.charAt(0).toUpperCase() + word.slice(1))
+ .join(' ');
+}
+
/**
* Module for generating food-related data.
*
@@ -47,11 +60,6 @@ export class FoodModule extends ModuleBase {
*/
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)