@dotcms/client
Version:
Official JavaScript library for interacting with DotCMS REST APIs.
21 lines (20 loc) • 740 B
TypeScript
/**
* @description
* Sanitizes the query for the given content type.
* It replaces the fields that are not content type fields with the correct format.
* Example: +field: -> +contentTypeVar.field:
*
* @example
*
* ```ts
* const query = '+field: value';
* const contentType = 'contentTypeVar';
* const sanitizedQuery = sanitizeQueryForContentType(query, contentType); // Output: '+contentTypeVar.field: value'
* ```
*
* @export
* @param {string} query - The query string to be sanitized.
* @param {string} contentType - The content type to be used for formatting the fields.
* @returns {string} The sanitized query string.
*/
export declare function sanitizeQueryForContentType(query: string, contentType: string): string;