String
Helper functions for string-based operations from files.
Functions
Section titled “Functions”formatWithPrettier()
Section titled “formatWithPrettier()”function formatWithPrettier(text, language, repoRoot): Promise<string>;Defined in: functions/string.ts:15
Helper function to format a text string with Prettier.
This is useful to ensure that a file is correctly formatted after modifying it but before writing it back to disk.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
text |
string |
language |
string |
repoRoot |
string |
Returns
Section titled “Returns”Promise<string>
setContentInsideHTMLMarker()
Section titled “setContentInsideHTMLMarker()”function setContentInsideHTMLMarker(original, text, markerName): string;Defined in: functions/string.ts:36
Helper function to set the content between two HTML comments.
For example, if the string has two lines containing “” and “”, then you would call this function with a marker name of “RULES_TABLE”.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
original |
string |
text |
string |
markerName |
string |
Returns
Section titled “Returns”string
The modified string.
