From f6827505712f48e448d4d4ef2dc3198e6967bbad Mon Sep 17 00:00:00 2001 From: Jeremy Hofer Date: Mon, 29 Apr 2024 05:24:45 -0400 Subject: feat(music): add album and artist methods (#2620) --- src/modules/music/index.ts | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) (limited to 'src/modules') diff --git a/src/modules/music/index.ts b/src/modules/music/index.ts index 332b4530..e3d56715 100644 --- a/src/modules/music/index.ts +++ b/src/modules/music/index.ts @@ -5,9 +5,43 @@ import { ModuleBase } from '../../internal/module-base'; * * ### Overview * - * Generate a random music genre with [`genre()`](https://fakerjs.dev/api/music.html#genre) or song name with [`songName()`](https://fakerjs.dev/api/music.html#songname). Both may be localized. + * Generate random music content. + * + * For a random album name, use [`album()`](https://fakerjs.dev/api/music.html#album). + * + * For a random artist, use [`artist()`](https://fakerjs.dev/api/music.html#artist). + * + * For a random genre, use [`genre()`](https://fakerjs.dev/api/music.html#genre). + * + * For a random song name, [`songName()`](https://fakerjs.dev/api/music.html#songname). + * + * All data types may be localized. */ export class MusicModule extends ModuleBase { + /** + * Returns a random album name. + * + * @example + * faker.music.album() // '1989' + * + * @since 9.0.0 + */ + album(): string { + return this.faker.helpers.arrayElement(this.faker.definitions.music.album); + } + + /** + * Returns a random artist name. + * + * @example + * faker.music.artist() // 'The Beatles' + * + * @since 9.0.0 + */ + artist(): string { + return this.faker.helpers.arrayElement(this.faker.definitions.music.artist); + } + /** * Returns a random music genre. * -- cgit v1.2.3