Skip to main content

String.dedent

Less than 1 minutefeaturees-proposal

String.dedentopen in new window

Module

esnext.string.dedentopen in new window

Types

interface StringConstructor {
  dedent(
    template: { raw: Array<string> },
    ...substitutions: Array<any>
  ): string;
  dedent<T>(
    tagFunction: (
      template: { raw: Array<string> },
      ...substitutions: Array<any>
    ) => T
  ): T;
}

Entry points

core-js/proposals/string-dedent
core-js(-pure)/full/string/dedent

Example

Exampleopen in new window:

const message = 42;
console.log(String.dedent`
  print('${message}')
`); // => print('42')
String.dedent(console.log)`
  print('${message}')
`; // => ["print('", "')", raw: Array(2)], 42