Instead if `if (subcategories.length < 2) { return true } else { return false }` use just `return subcategories.length < 2`