Skip to main content

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

ParameterType
textstring
language"typescript" | "markdown"
repoRootstring

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

ParameterType
originalstring
textstring
markerNamestring

Returns

string

The modified string.

Defined in

packages/complete-node/src/functions/string.ts:36