Comparing version 1.2.7 to 1.2.8
@@ -25,3 +25,21 @@ /** | ||
if (!provider || !tracks) throw new Error('[Ksoft API] Please specify the provider and tracks parameters'); | ||
const allowedProviders = ['youtube_ids', 'youtube', 'spotify']; | ||
if (!allowedProviders.some(item => item === provider)) | ||
throw new Error( | ||
'[Ksoft API] Please specify the correct provider. Options: youtube_ids, youtube, or spotify' | ||
); | ||
if (typeof tracks === 'object') { | ||
if (tracks.length < 1) throw new Error('[Ksoft API] Please provide a track to search'); | ||
if (tracks.length > 5) throw new Error('[Ksoft API] Please provide less than or equal to 5 tracks'); | ||
} | ||
if (tracks.slice('').some(item => item === ',')) { | ||
const trackArray = tracks.slice(','); | ||
if (trackArray.length < 1) throw new Error('[Ksoft API] Please provide a track to search'); | ||
if (trackArray.length > 5) throw new Error('[Ksoft API] Please provide less than or equal to 5 tracks'); | ||
} | ||
if (tracks.slice('').some(item => item === '\n')) { | ||
const trackArray = tracks.slice('\n'); | ||
if (trackArray.length < 1) throw new Error('[Ksoft API] Please provide a track to search'); | ||
if (trackArray.length > 5) throw new Error('[Ksoft API] Please provide less than or equal to 5 tracks'); | ||
} | ||
const { data } = await this.http.post('/music/recommendations', { | ||
@@ -28,0 +46,0 @@ provider: provider, |
{ | ||
"name": "ksoft.js", | ||
"version": "1.2.7", | ||
"version": "1.2.8", | ||
"description": "Official API Wrapper for KSoft.Si API, written in Node.js", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
89508
1166