"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isIrrelevantNodeType = exports.IRRELEVANT_NODE_TYPES = exports.matchesNodeFilter = void 0;
const types_1 = require("@stoplight/types");
function matchesNodeFilter(branchNode, filter) {
    if (!filter)
        return true;
    let isMatch = false;
    if (filter.nodeType) {
        isMatch = filter.nodeType === branchNode.snapshot.type;
    }
    if (filter.nodeUri) {
        const uri = branchNode.baseUri || branchNode.node.uri;
        isMatch = uri.startsWith(filter.nodeUri);
    }
    return isMatch;
}
exports.matchesNodeFilter = matchesNodeFilter;
exports.IRRELEVANT_NODE_TYPES = Object.freeze([types_1.NodeType.Generic, types_1.NodeType.Unknown].map(String));
function isIrrelevantNodeType(type) {
    return exports.IRRELEVANT_NODE_TYPES.includes(type);
}
exports.isIrrelevantNodeType = isIrrelevantNodeType;
//# sourceMappingURL=node.js.map