[F] formatIdentifier
function formatIdentifier(sv): string;
Print a string as a TypeSpec identifier. If the string is a valid identifier, return it as is otherwise wrap it into backticks.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
sv | string | Identifier string value. |
Returns
Section titled “Returns”string
Identifier string as it would be represented in a TypeSpec file.
Example
Section titled “Example”printIdentifier("foo") // fooprintIdentifier("foo bar") // `foo bar`