hasLiquidSyntax() function
Checks whether a string contains Liquid template syntax.
Signature
export declare function hasLiquidSyntax(value: string): boolean;
Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
value |
string |
The string to check for Liquid syntax. |
Returns
boolean
true if the string contains Liquid syntax markers, false otherwise.
Remarks
This utility function detects the presence of Liquid template markers in a string, indicating that the string requires template processing.
Liquid syntax patterns detected:
- Variable output:
{{marks the start of a variable interpolation (e.g.,{{ package.name }}). - Control flow:
{%marks the start of a tag for logic or iteration (e.g.,{% if condition %},{% for item in array %}).
The function uses a regular expression to efficiently scan the string for these markers without needing to check for both patterns separately. This is more efficient than calling includes() twice and provides a single point of maintenance for Liquid syntax detection logic.
Common usage:
- Determine whether to process a value through the Liquid engine.
- Skip unnecessary template evaluation for static strings.
- Validate configuration values for template content.
Generated via tsdoc2docusaurus 1.3.2 by API Extractor/Documenter 7.57.2.