"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.massagePattern = exports.matcherOR = void 0;
const tslib_1 = require("tslib");
const is_1 = tslib_1.__importDefault(require("@sindresorhus/is"));
function matcherOR(matchType, groupMatchers, inputConfig, packageRule) {
    let positiveMatch = false;
    let matchApplied = false;
    for (const matcher of groupMatchers) {
        let isMatch;
        switch (matchType) {
            case 'excludes':
                isMatch = matcher.excludes(inputConfig, packageRule);
                break;
            case 'matches':
                isMatch = matcher.matches(inputConfig, packageRule);
                break;
        }
        // no rules are defined
        if (is_1.default.nullOrUndefined(isMatch)) {
            continue;
        }
        matchApplied = true;
        if (is_1.default.truthy(isMatch)) {
            positiveMatch = true;
        }
    }
    return matchApplied ? positiveMatch : null;
}
exports.matcherOR = matcherOR;
function massagePattern(pattern) {
    return pattern === '^*$' || pattern === '*' ? '.*' : pattern;
}
exports.massagePattern = massagePattern;
//# sourceMappingURL=utils.js.map