Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

dedent-tag

blakeembrey152MIT1.0.1TypeScript support: included

ES2015 tagged template string for removing indent from strings

dedent, strip, indent, textwrap, python, template, string, tag, es2015, es6

readme

Dedent Tag

NPM version NPM downloads Build status Test coverage

ES2015 tagged template string for removing indent from strings.

Mirrors on textwrap.dedent, but ignores interpolated values. Why? You can embed dedented strings without breaking indent calculation.

Installation

npm install dedent-tag --save

Usage

import dedent from "dedent-tag";

const text = dedent`
  text
  with
  multiple
    lines
`; //=> "\ntext\nwith\nmultiple\nlines\n"

// End first line with `\` to avoid empty line!
const text = dedent`\
  more
  text
`; //=> "more\ntext\n"

License

MIT