# @mvasilkov/outdent

> Remove extra indentation from multiline strings.

Latest version **1.0.5** (published 2020-04-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install @mvasilkov/outdent
pnpm add @mvasilkov/outdent
yarn add @mvasilkov/outdent
bun add @mvasilkov/outdent
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2020-04-25 |
| First published | 2020-01-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Mark Vasilkov |
| Maintainers | mvasilkov |
| Keywords | heredoc, indent, indentation, outdent, template literal, template string, unindent, no-dependencies |

## Links

- npm: https://www.npmjs.com/package/@mvasilkov/outdent
- Repository: https://github.com/mvasilkov/outdent
- Homepage: https://github.com/mvasilkov/outdent#readme
- Issues: https://github.com/mvasilkov/outdent/issues
- npm.io page: https://npm.io/package/@mvasilkov/outdent

## 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.5 (latest) — 2020-04-25
- 1.0.4 — 2020-02-15
- 1.0.3 — 2020-01-20
- 1.0.2 — 2020-01-20
- 1.0.1 — 2020-01-20
- 1.0.0 — 2020-01-19

## README

outdent
===

Remove extra indentation from multiline strings.

[![npm][npm-badge]][npm-url]
[![no dependencies][dependencies-badge]][dependencies-url]

---

Use [@mvasilkov/outdent][npm-url] to remove extraneous leading whitespace from
multiline strings. This makes your hair silky and shiny, and probably has
other uses.

Installation
---

```sh
npm add @mvasilkov/outdent
```

Usage
---

```javascript
const { outdent } = require('@mvasilkov/outdent')

console.log(outdent(`
    The nine most terrifying words in the English language are,
    “I’m from the government and I’m here to help.”
`))
```

Syntax
---

**outdent(string, [options])**

Receives a string, returns a string with unnecessary indentation removed.

**outdentLines(strings, [options])**

Accepts an array of strings, returns an array of strings. Useful when you have
an array of strings.

Options
---

**{ strict: true }**

Treat the indentation of the first line as meaningful. This is usually the
case when loading strings from a file.

**{ strict: false }**

Ignore the first line's indentation, and drop the first and the last line when
empty. Useful for writing multiline strings in JS. **This is the default.**

**{ endWithNewline: true }**

When enabled, insert a line break at the end of the result, if there is none.
Does nothing when **strict: true** is in effect.

License
---

MIT

[npm-badge]: https://img.shields.io/npm/v/@mvasilkov/outdent.svg?style=flat
[npm-url]: https://www.npmjs.com/package/@mvasilkov/outdent
[dependencies-badge]: https://img.shields.io/david/mvasilkov/outdent?style=flat
[dependencies-url]: https://www.npmjs.com/package/@mvasilkov/outdent?activeTab=dependencies

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