Skip to content

Function inspectString() ​

inspectString(string: string, options?: InspectionOptions): string

Source: inspect.ts

Generates a literal string representation of a string.

Parameters ​

string ​

string

The string to inspect.

options? ​

InspectionOptions

Optional inspection options.

Returns ​

string

The resulting string.

Example ​

Note: The following examples omit or shorten the options parameter for simplicity. In reality, the return values will contain ANSI escape codes unless you explicitly set colors to false.

ts
inspect("Example") === "\"Example\""
inspect("Example", { singleQuotes: true }) === "'Example'"

Built by Prozilla