andrade-soulseek-downloader
Version:
Simple, safe Soulseek download library with built-in rate limiting to prevent bans
13 lines • 490 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.matches = void 0;
const matches = (str, query) => {
const toBeMatched = str.toLowerCase();
return query.toLowerCase().split(' ')
.map(criterion => criterion.startsWith('-')
? toBeMatched.indexOf(criterion.substring(1)) === -1
: toBeMatched.indexOf(criterion) !== -1)
.reduce((a, b) => a && b, true);
};
exports.matches = matches;
//# sourceMappingURL=matches.js.map