erelasfy
Version:
A plugin for erela.js to play music from spotify
28 lines (27 loc) • 1.14 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.validateOptions = void 0;
function validateOptions(options) {
if (!options.clientId)
throw new Error('Missing Spotify client ID');
if (typeof options.clientId != 'string')
throw new TypeError('options.clientId must be a string');
if (!options.clientSecret)
throw new Error('Missing Spotify client secret');
if (typeof options.clientSecret != 'string')
throw new TypeError('options.clientSecret must be a string');
if (options.playlistLimit) {
if (isNaN(options.playlistLimit) ||
options.playlistLimit < 1 ||
!Number.isInteger(options.playlistLimit))
throw new TypeError('options.playlistLimit must be a valid integer');
}
if (options.albumLimit) {
if (isNaN(options.albumLimit) ||
options.albumLimit < 1 ||
!Number.isInteger(options.albumLimit))
throw new TypeError('options.albumLimit must be a valid integer');
}
return true;
}
exports.validateOptions = validateOptions;