From ced83e862a15c688b138c0cb881b88635480768d Mon Sep 17 00:00:00 2001 From: patrickkfkan Date: Sun, 24 Jan 2021 02:41:26 +0800 Subject: [PATCH] Loose compare in sanitize --- lib/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/index.js b/lib/index.js index d8bd209..f9135b8 100644 --- a/lib/index.js +++ b/lib/index.js @@ -31,7 +31,7 @@ async function sanitizeDiscoverParams(params) { return getDiscoverOptions().then( options => { const getOptionValue = (optArr, value) => { if (value !== undefined && optArr) { - const opt = optArr.find( o => o.value === value ); + const opt = optArr.find( o => o.value == value ); if (opt) { return opt.value; } @@ -54,7 +54,7 @@ async function sanitizeDiscoverParams(params) { if (subgenreOptions) { // false if genre is 'all' sanitized.subgenre = getOptionValue(subgenreOptions, params.subgenre); } - const timeAllowed = sanitized.subgenre === undefined || sanitized.subgenre === subgenreOptions[0].value; + const timeAllowed = sanitized.subgenre === undefined || sanitized.subgenre == subgenreOptions[0].value; if (timeAllowed) { sanitized.time = getOptionValue(options.times, params.time); }