# redent

> Strip redundant indentation and indent the string

Latest version **4.0.0** (published 2021-05-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install redent
pnpm add redent
yarn add redent
bun add redent
```

## Health

**Score 43/100 (D)** — status: abandoned.

Positive: has types package; esm support; no vulnerabilities; high maintenance score; high quality score.

Warnings: low downloads.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 4.0.0 |
| Published | 2021-05-03 |
| First published | 2015-09-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/redent) |
| Module format | ESM |
| Node | >=12 |
| Dependencies | 2 |
| Unpacked size | 3.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 55 |
| Author | Sindre Sorhus |
| Maintainers | sindresorhus |
| Keywords | string, strip, trim, indent, indentation, add, reindent, normalize, remove, whitespace, space |

## Links

- npm: https://www.npmjs.com/package/redent
- Repository: https://github.com/sindresorhus/redent
- Homepage: https://github.com/sindresorhus/redent#readme
- Issues: https://github.com/sindresorhus/redent/issues
- Funding: https://github.com/sponsors/sindresorhus
- npm.io page: https://npm.io/package/redent

## Dependencies (2)

- [strip-indent](https://npm.io/package/strip-indent.md) ^4.0.0
- [indent-string](https://npm.io/package/indent-string.md) ^5.0.0

## 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

- 4.0.0 (latest) — 2021-05-03
- 3.0.0 — 2019-04-26
- 2.0.0 — 2016-07-10
- 1.0.0 — 2015-09-29

## README

# redent

> [Strip redundant indentation](https://github.com/sindresorhus/strip-indent) and [indent the string](https://github.com/sindresorhus/indent-string)

## Install

```
$ npm install redent
```

## Usage

```js
import redent from 'redent';

redent('\n  foo\n    bar\n', 1);
//=> '\n foo\n   bar\n'
```

## API

### redent(string, count?, options?)

#### string

Type: `string`

The string to normalize indentation.

#### count

Type: `number`\
Default: `0`

How many times you want `options.indent` repeated.

#### options

Type: `object`

##### indent

Type: `string`\
Default: `' '`

The string to use for the indent.

##### includeEmptyLines

Type: `boolean`\
Default: `false`

Also indent empty lines.

---

<div align="center">
	<b>
		<a href="https://tidelift.com/subscription/pkg/npm-redent?utm_source=npm-redent&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
	</b>
	<br>
	<sub>
		Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
	</sub>
</div>

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