String.dedent

Specification: proposal-string-dedent

Modules

esnext.string.dedent

class String {
  static dedent(templateOrTag: { raw: Array<string> } | function, ...substitutions: Array<string>): string | function;
}

CommonJS entry points

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

Example

const message = 42;

console.log(String.dedent`
  print('${ message }')
`); // => print('42')

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