Skip to main content

functions/string

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

ParameterType
textstring
language"typescript" | "markdown"
repoRootstring

Returns

Promise<string>

Defined in

functions/string.ts:9


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

ParameterType
originalstring
textstring
markerNamestring

Returns

string

The modified string.

Defined in

functions/string.ts:30