Skip to content

dedent

Import from @varavel/vdl-plugin-sdk/utils/strings.

function dedent(input): string;

Removes shared indentation from a multi-line string.

This helper is useful for generating readable code templates, markdown, or text fixtures inside plugins without carrying indentation from the source file into the final output.

Parameters

Parameter Type Description
input string Multi-line string to dedent.

Returns

string

The same text with common indentation removed.

Example

dedent(`
         export interface User {
           id: string;
         }
`);
// returns "export interface User {\n  id: string;\n}"

See

Powered by dedent (MIT License): https://github.com/dmnd/dedent