Implemented methods have code like this:
const searchGenre = Array.isArray(genre) ? genre : Array(genre)
if input a string: “Mystery, Thriller” it will return Array of ONE element [‘Mystery, Thriller’] instead of array of TWO elements.
As a solution:
static stringToArray(str) {
return str.split(/;|.|,/g).map(c => c.trim());
}
const searchGenre = Array.isArray(genre) ? genre : this.stringToArray(genre)