diff options
| author | ST-DDT <[email protected]> | 2024-11-14 22:50:04 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-11-14 21:50:04 +0000 |
| commit | 188309a59cfe6fbd33e120dedf3bdfef3276d641 (patch) | |
| tree | 079d062e07065b11ae0bcf8c8cb964174a842080 /src/modules/food | |
| parent | a54c1edb87e88b198966d248d5273c9898c32798 (diff) | |
| download | faker-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.ts | 18 |
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) |
