dedent-tag

ES2015 tagged template string for removing indent from strings

Usage no npm install needed!

<script type="module">
  import dedentTag from 'https://cdn.skypack.dev/dedent-tag';
</script>

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