All files / src/libs/Search SearchOperator.ts

100% Statements 6/6
100% Branches 0/0
100% Functions 4/4
100% Lines 6/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 403x             3x           38x             80x               1x               41x      
import SearchElement from './SearchElement';
import { SearchOperatorType } from './SearchOperatorTypes';
 
/**
 * Class representing a search operator.
 * This class extends the SearchElement class and is used to handle operators in a search query.
 */
export default class SearchOperator extends SearchElement {
    /**
     * Constructs a new SearchOperator with the given operator.
     * @param operator - The operator value, which can be '&', '|' or '!'.
     */
    constructor(operator: SearchOperatorType) {
        super(operator);
    }
 
    /**
     * Gets the operator value of the search element.
     */
    public get operator(): SearchOperatorType {
        return this._value as SearchOperatorType;
    }
 
    /**
     * Sets the operator value of the search element.
     * @param value - The new operator value to be set.
     */
    public set operator(value: SearchOperatorType) {
        this._value = value;
    }
 
    /**
     * Determines if the element is an operator.
     * This method overrides the abstract method in the base class.
     */
    public get isOperator(): boolean {
        return true;
    }
}
 
Zur TypeDoc-Dokumentation