blob: e3d56715b1ca62cfa44780a59dc8c745984e0220 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
import { ModuleBase } from '../../internal/module-base';
/**
* Module to generate music related entries.
*
* ### Overview
*
* 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.
*
* @example
* faker.music.genre() // 'Reggae'
*
* @since 5.2.0
*/
genre(): string {
return this.faker.helpers.arrayElement(this.faker.definitions.music.genre);
}
/**
* Returns a random song name.
*
* @example
* faker.music.songName() // 'White Christmas'
*
* @since 7.1.0
*/
songName(): string {
return this.faker.helpers.arrayElement(
this.faker.definitions.music.song_name
);
}
}
|