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 40 41 42 | import { ISearch_ } from './interfaces/ISearch'; import SearchParser from './SearchParser'; import SearchQuery from './SearchQuery'; /** * Represents a search operation. */ const search_: ISearch_ = class Search { private readonly _searchQueryText: string; private _searchQuery: SearchQuery | undefined; /** * Creates a new instance of the Search class. * @param searchQueryText The search query text. */ constructor(searchQueryText: string) { this._searchQueryText = searchQueryText; } /** * Parses the search query text. */ public parse(): void { this._searchQuery = SearchParser.parse(this._searchQueryText); } /** * Applies the search logic to the given text. * @param text The text to apply the search logic to. * @returns True if the text matches the search query, false otherwise. */ public applySearchLogic(text: string): boolean { Iif (!this._searchQuery) { this.parse(); } return this._searchQuery?.matches(text) ?? false; } }; export { search_ as Search }; |