# dedent-js

> Remove indentation from multiline strings

Latest version **1.0.1** (published 2015-09-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install dedent-js
pnpm add dedent-js
yarn add dedent-js
bun add dedent-js
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2015-09-19 |
| First published | 2015-09-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 55 |
| Author | Martin Kolárik |
| Maintainers | martin-kolarik |
| Keywords | multiline strings, template literals, template strings, dedent, deintend, indentation, es6, harmony |

## Links

- npm: https://www.npmjs.com/package/dedent-js
- Repository: https://github.com/MartinKolarik/dedent-js
- Homepage: https://github.com/MartinKolarik/dedent-js/
- Issues: https://github.com/MartinKolarik/dedent-js/issues/
- npm.io page: https://npm.io/package/dedent-js

## Alternatives

- [@mce/gif](https://npm.io/package/@mce/gif.md) — 2.6K weekly downloads
- [cleanse](https://npm.io/package/cleanse.md) — 173 weekly downloads
- [str](https://npm.io/package/str.md) — 127 weekly downloads
- [naming](https://npm.io/package/naming.md) — 95 weekly downloads
- [tap-telco-api](https://npm.io/package/tap-telco-api.md) — 19 weekly downloads

## Recent versions

- 1.0.1 (latest) — 2015-09-19
- 1.0.0 — 2015-09-19

## README

# dedent-js

Removes indentation from multiline strings. Works with both tabs and spaces.

## Installation

```
$ npm install dedent-js
```

## Usage

```js
// Dedent can be also used as a function.
expect(dedent`Line #1
	Line #2
	Line #3`).to.equal('Line #1\nLine #2\nLine #3');

// Leading/trailing line break is removed.
expect(
	dedent`
	Line #1
	Line #2
	Line #3
	`
).to.equal('Line #1\nLine #2\nLine #3');

// No more than one leading/trailing line break is removed.
expect(
	dedent`

	Line #1
	Line #2
	Line #3

	`
).to.equal('\nLine #1\nLine #2\nLine #3\n');

// Only the "base" indentation is removed.
expect(
	dedent`
	Line #1
		Line #2
			Line #3
	`
).to.equal('Line #1\n\tLine #2\n\t\tLine #3');

// The last line is ignored if it doesn't contain anything else than whitespace.
expect(
	function () {
		return dedent`
			Line #1
			Line #2
			Line #3
		`;
	}()
).to.equal('Line #1\nLine #2\nLine #3');

// Escaped characters are NOT ignored.
expect(
	dedent`
	\tLine #1
	\tLine #2
	\tLine #3
	`
).to.equal('Line #1\nLine #2\nLine #3');
```

## License
Copyright (c) 2015 Martin Kolárik. Released under the MIT license.

---
_Source: https://npm.io/package/dedent-js · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
