diff options
| author | Suyash Gulati <[email protected]> | 2024-10-29 21:18:32 +0530 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-10-29 16:48:32 +0100 |
| commit | c02beeadd49e48656a0307451517e9751e3118c3 (patch) | |
| tree | 96ec1e3294b510acea9e733807ce1b9959b38034 /src | |
| parent | 081a795411887a8b67bc0718eb5149e1bb5e5dfb (diff) | |
| download | faker-c02beeadd49e48656a0307451517e9751e3118c3.tar.xz faker-c02beeadd49e48656a0307451517e9751e3118c3.zip | |
feat(animal): add petName method (#3196)
Diffstat (limited to 'src')
| -rw-r--r-- | src/definitions/animal.ts | 1 | ||||
| -rw-r--r-- | src/locales/en/animal/index.ts | 2 | ||||
| -rw-r--r-- | src/locales/en/animal/pet_name.ts | 44 | ||||
| -rw-r--r-- | src/modules/animal/index.ts | 14 |
4 files changed, 61 insertions, 0 deletions
diff --git a/src/definitions/animal.ts b/src/definitions/animal.ts index d5d95505..afa86753 100644 --- a/src/definitions/animal.ts +++ b/src/definitions/animal.ts @@ -19,4 +19,5 @@ export type AnimalDefinition = LocaleEntry<{ rodent: string[]; snake: string[]; type: string[]; + pet_name: string[]; }>; diff --git a/src/locales/en/animal/index.ts b/src/locales/en/animal/index.ts index f43813a0..7a28c567 100644 --- a/src/locales/en/animal/index.ts +++ b/src/locales/en/animal/index.ts @@ -14,6 +14,7 @@ import fish from './fish'; import horse from './horse'; import insect from './insect'; import lion from './lion'; +import pet_name from './pet_name'; import rabbit from './rabbit'; import rodent from './rodent'; import snake from './snake'; @@ -31,6 +32,7 @@ const animal: AnimalDefinition = { horse, insect, lion, + pet_name, rabbit, rodent, snake, diff --git a/src/locales/en/animal/pet_name.ts b/src/locales/en/animal/pet_name.ts new file mode 100644 index 00000000..acbc0f60 --- /dev/null +++ b/src/locales/en/animal/pet_name.ts @@ -0,0 +1,44 @@ +export default [ + 'Ace', + 'Archie', + 'Bailey', + 'Bandit', + 'Bella', + 'Bentley', + 'Bruno', + 'Buddy', + 'Charlie', + 'Coco', + 'Cookie', + 'Cooper', + 'Daisy', + 'Dixie', + 'Finn', + 'Ginger', + 'Gracie', + 'Gus', + 'Hank', + 'Jack', + 'Jax', + 'Joey', + 'Kobe', + 'Leo', + 'Lola', + 'Louie', + 'Lucy', + 'Maggie', + 'Max', + 'Mia', + 'Milo', + 'Molly', + 'Murphey', + 'Nala', + 'Nova', + 'Ollie', + 'Oreo', + 'Rosie', + 'Scout', + 'Stella', + 'Teddy', + 'Tuffy', +]; diff --git a/src/modules/animal/index.ts b/src/modules/animal/index.ts index 5a885bbd..bb200a31 100644 --- a/src/modules/animal/index.ts +++ b/src/modules/animal/index.ts @@ -201,4 +201,18 @@ export class AnimalModule extends ModuleBase { type(): string { return this.faker.helpers.arrayElement(this.faker.definitions.animal.type); } + + /** + * Returns a random pet name. + * + * @example + * faker.animal.petName() // 'Coco' + * + * @since 9.2.0 + */ + petName(): string { + return this.faker.helpers.arrayElement( + this.faker.definitions.animal.pet_name + ); + } } |
