import { assert } from "../../../core/assert.js";
import { MarkerNodeMatcher } from "./MarkerNodeMatcher.js";

export class MarkerNodeMatcherContainsTag extends MarkerNodeMatcher {

    /**
     *
     * @type {String}
     */
    tag = null;


    static from(tag) {
        assert.isString(tag, 'tag');

        const r = new MarkerNodeMatcherContainsTag();

        r.tag = tag;

        return r;
    }

    match(node) {
        return node.tags.indexOf(this.tag) !== -1;
    }
}
