UNPKG

@empathyco/x-components

Version:
36 lines (20 loc) 1.19 kB
<!-- Do not edit this file. It is automatically generated by API Documenter. --> [Home](./index.md) &gt; [@empathyco/x-components](./x-components.md) &gt; [isNewQuery](./x-components.isnewquery.md) ## isNewQuery() function Compares two queries to know if the new one is a refined query from the previous one or a new one. A refined query is a query which has the previous query or part of it. Example: - previousQuery = 'lego star'. - newQuery = 'lego star wars'. Example: - previousQuery = 'lego star wars'. - newQuery = 'lego star'. A new query is a query which has not the previous query. Example: - previousQuery = 'lego star'. - newQuery = 'lego wars'. In this case, it is changing the word set, because a word is changed by another one, so this is changing the search intention. **Signature:** ```typescript export declare function isNewQuery(newQuery: string, previousQuery: string): boolean; ``` ## Parameters | Parameter | Type | Description | | --- | --- | --- | | newQuery | string | The new query. | | previousQuery | string | The previous query. | **Returns:** boolean A boolean which flags if the query is refined or not.