Skip to content

Latest commit

 

History

History
80 lines (61 loc) · 2.49 KB

string-dedent.md

File metadata and controls

80 lines (61 loc) · 2.49 KB

StringConstructor (interface)

interface StringConstructor {
  dedent: {
    (input: string): string;
    (
      strings: readonly string[] | ArrayLike<string>,
      ...substitutions: unknown[]
    ): string;
    <
      Func extends (
        strings: readonly string[] | ArrayLike<string>,
        ...substitutions: any[]
      ) => string
    >(
      input: Func
    ): Func;
  };
}

StringConstructor.dedent (function property)

The function String.dedent can be used to remove leading indentation from a string. It is commonly used as a tagged template function, but you can also call it and pass in a string.

Note that the first line of the string must be empty.

String.dedent is the default export from the npm package string-dedent. See its readme on npm for more info: https://www.npmjs.com/package/string-dedent

dedent: {
  (input: string): string;
  (strings: readonly string[] | ArrayLike<string>, ...substitutions: unknown[]): string;
  <Func extends (strings: readonly string[] | ArrayLike<string>, ...substitutions: any[]) => string>(input: Func): Func;
};

StringConstructor.dedent(...) (call signature)

Removes leading minimum indentation from the string input. The first line of input MUST be empty.

For more info, see: https://www.npmjs.com/package/string-dedent#usage

(input: string): string;

StringConstructor.dedent(...) (call signature)

Removes leading minimum indentation from the tagged template literal. The first line of the template literal MUST be empty.

For more info, see: https://www.npmjs.com/package/string-dedent#usage

(strings: readonly string[] | ArrayLike<string>, ...substitutions: unknown[]): string;

StringConstructor.dedent(...) (call signature)

Wrap another template tag function such that tagged literals become dedented before being passed to the wrapped function.

For more info, see: https://www.npmjs.com/package/string-dedent#usage

<Func extends (strings: readonly string[] | ArrayLike<string>, ...substitutions: any[]) => string>(input: Func): Func;