magmastream 2.9.0-dev.5 → 2.9.0-dev.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/utils/managerCheck.js +11 -11
- package/package.json +1 -1
|
@@ -16,19 +16,19 @@ function managerCheck(options) {
|
|
|
16
16
|
throw new TypeError('Manager option "playNextOnEnd" must be a boolean.');
|
|
17
17
|
}
|
|
18
18
|
// Validate clientName option
|
|
19
|
-
if (typeof clientName !== undefined) {
|
|
19
|
+
if (typeof clientName !== "undefined") {
|
|
20
20
|
if (typeof clientName !== "string" || clientName.trim().length === 0) {
|
|
21
21
|
throw new TypeError('Manager option "clientName" must be a non-empty string.');
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
// Validate defaultSearchPlatform option
|
|
25
|
-
if (typeof defaultSearchPlatform !== undefined) {
|
|
25
|
+
if (typeof defaultSearchPlatform !== "undefined") {
|
|
26
26
|
if (!Object.values(Manager_1.SearchPlatform).includes(defaultSearchPlatform)) {
|
|
27
27
|
throw new TypeError(`Manager option "defaultSearchPlatform" must be one of: ${Object.values(Manager_1.SearchPlatform).join(", ")}.`);
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
// Validate autoPlaySearchPlatforms
|
|
31
|
-
if (autoPlaySearchPlatforms !== undefined) {
|
|
31
|
+
if (typeof autoPlaySearchPlatforms !== "undefined") {
|
|
32
32
|
if (!Array.isArray(autoPlaySearchPlatforms)) {
|
|
33
33
|
throw new TypeError('Manager option "autoPlaySearchPlatforms" must be an array.');
|
|
34
34
|
}
|
|
@@ -37,11 +37,11 @@ function managerCheck(options) {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
// Validate nodes option
|
|
40
|
-
if (typeof nodes === undefined || !Array.isArray(nodes)) {
|
|
40
|
+
if (typeof nodes === "undefined" || !Array.isArray(nodes)) {
|
|
41
41
|
throw new TypeError('Manager option "nodes" must be an array.');
|
|
42
42
|
}
|
|
43
43
|
// Validate enabledPlugins option
|
|
44
|
-
if (typeof enabledPlugins !== undefined && !Array.isArray(enabledPlugins)) {
|
|
44
|
+
if (typeof enabledPlugins !== "undefined" && !Array.isArray(enabledPlugins)) {
|
|
45
45
|
throw new TypeError('Manager option "enabledPlugins" must be a Plugin array.');
|
|
46
46
|
}
|
|
47
47
|
// Validate send option
|
|
@@ -49,7 +49,7 @@ function managerCheck(options) {
|
|
|
49
49
|
throw new TypeError('Manager option "send" must be present and a function.');
|
|
50
50
|
}
|
|
51
51
|
// Validate trackPartial option
|
|
52
|
-
if (typeof trackPartial !== undefined) {
|
|
52
|
+
if (typeof trackPartial !== "undefined") {
|
|
53
53
|
if (!Array.isArray(trackPartial)) {
|
|
54
54
|
throw new TypeError('Manager option "trackPartial" must be an array.');
|
|
55
55
|
}
|
|
@@ -58,7 +58,7 @@ function managerCheck(options) {
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
// Validate enablePriorityMode option
|
|
61
|
-
if (typeof enablePriorityMode !== undefined && typeof enablePriorityMode !== "boolean") {
|
|
61
|
+
if (typeof enablePriorityMode !== "undefined" && typeof enablePriorityMode !== "boolean") {
|
|
62
62
|
throw new TypeError('Manager option "enablePriorityMode" must be a boolean.');
|
|
63
63
|
}
|
|
64
64
|
// Validate node priority if enablePriorityMode is enabled
|
|
@@ -70,7 +70,7 @@ function managerCheck(options) {
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
// Validate useNode option
|
|
73
|
-
if (typeof useNode !== undefined) {
|
|
73
|
+
if (typeof useNode !== "undefined") {
|
|
74
74
|
if (typeof useNode !== "string") {
|
|
75
75
|
throw new TypeError('Manager option "useNode" must be a string "leastLoad" or "leastPlayers".');
|
|
76
76
|
}
|
|
@@ -79,15 +79,15 @@ function managerCheck(options) {
|
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
// Validate normalizeYouTubeTitles option
|
|
82
|
-
if (typeof normalizeYouTubeTitles !== undefined && typeof normalizeYouTubeTitles !== "boolean") {
|
|
82
|
+
if (typeof normalizeYouTubeTitles !== "undefined" && typeof normalizeYouTubeTitles !== "boolean") {
|
|
83
83
|
throw new TypeError('Manager option "normalizeYouTubeTitles" must be a boolean.');
|
|
84
84
|
}
|
|
85
85
|
// Validate lastFmApiKey option
|
|
86
|
-
if (typeof lastFmApiKey !== undefined && (typeof lastFmApiKey !== "string" || lastFmApiKey.trim().length === 0)) {
|
|
86
|
+
if (typeof lastFmApiKey !== "undefined" && (typeof lastFmApiKey !== "string" || lastFmApiKey.trim().length === 0)) {
|
|
87
87
|
throw new TypeError('Manager option "lastFmApiKey" must be a non-empty string.');
|
|
88
88
|
}
|
|
89
89
|
// Validate maxPreviousTracks option
|
|
90
|
-
if (typeof maxPreviousTracks !== undefined) {
|
|
90
|
+
if (typeof maxPreviousTracks !== "undefined") {
|
|
91
91
|
if (typeof maxPreviousTracks !== "number" || isNaN(maxPreviousTracks)) {
|
|
92
92
|
throw new TypeError('Manager option "maxPreviousTracks" must be a number.');
|
|
93
93
|
}
|