String
Helper functions for string-based operations from files.
Functions
formatWithPrettier()
function formatWithPrettier(
text,
language,
repoRoot): Promise<string>
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
Parameter | Type |
---|---|
text | string |
language | "typescript" | "markdown" |
repoRoot | string |
Returns
Promise
<string
>
Defined in
packages/complete-node/src/functions/string.ts:15
setContentInsideHTMLMarker()
function setContentInsideHTMLMarker(
original,
text,
markerName): string
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
Parameter | Type |
---|---|
original | string |
text | string |
markerName | string |
Returns
string
The modified string.