Skip to content

Использовать фильтр match для массива исполнителей #55

Discussion options

You must be logged in to vote

Добавьте следующую функцию по инструкции, чтобы не потерять при обновлении.

Filter.matchAll = function (items, strRegex, invert = false) {
    let regex = new RegExp(strRegex, 'i');
    let filteredTracks = items.filter((item) => {
        if (typeof item == 'undefined') {
            return false;
        } else if (item.hasOwnProperty('album')) {
            return invert ^ (regex.test(item.name.formatName()) || regex.test(item.album.name.formatName()) || regex.test(item.artists[0].name.formatName()));
        }
        return invert ^ regex.test(item.name.formatName());
    });
    Combiner.replace(items, filteredTracks);
};

Replies: 3 comments 13 replies

Comment options

You must be logged in to vote
1 reply
@amd64fox
Comment options

Comment options

You must be logged in to vote
2 replies
@amd64fox
Comment options

@amd64fox
Comment options

Answer selected by Chimildic
Comment options

You must be logged in to vote
10 replies
@amd64fox
Comment options

@Chimildic
Comment options

@amd64fox
Comment options

@Chimildic
Comment options

@amd64fox
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants