# indent-string

> Indent each line in a string

Latest version **5.0.0** (published 2021-04-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install indent-string
pnpm add indent-string
yarn add indent-string
bun add indent-string
```

## 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 | 5.0.0 |
| Published | 2021-04-17 |
| First published | 2014-06-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/indent-string) |
| Module format | ESM |
| Node | >=12 |
| Dependencies | 0 |
| Unpacked size | 4.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 116 |
| Author | Sindre Sorhus |
| Maintainers | sindresorhus |
| Keywords | indent, string, pad, align, line, text, each, every |

## Links

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

## Alternatives

- [localforage](https://npm.io/package/localforage.md) — 6.2M weekly downloads
- [localforage-observable](https://npm.io/package/localforage-observable.md) — 30.8K weekly downloads
- [@y/y](https://npm.io/package/@y/y.md) — 30.1K weekly downloads
- [@metaobjectsdev/render](https://npm.io/package/@metaobjectsdev/render.md) — 3.5K weekly downloads
- [@ledgerhq/coin-algorand](https://npm.io/package/@ledgerhq/coin-algorand.md) — 1.1K weekly downloads

## Recent versions

- 5.0.0 (latest) — 2021-04-17
- 4.0.0 — 2019-04-17
- 3.2.0 — 2017-07-23
- 3.1.0 — 2017-01-25
- 3.0.0 — 2016-06-23
- 2.1.0 — 2015-08-21
- 2.0.0 — 2015-07-25
- 1.2.2 — 2015-07-20
- 1.2.1 — 2015-02-16
- 1.2.0 — 2014-10-22
- 1.1.0 — 2014-09-03
- 1.0.0 — 2014-08-17
- 0.1.3 — 2014-06-07
- 0.1.2 — 2014-06-07
- 0.1.1 — 2014-06-06
- … 1 more at https://npm.io/package/indent-string/versions

## README

# indent-string

> Indent each line in a string

## Install

```
$ npm install indent-string
```

## Usage

```js
import indentString from 'indent-string';

indentString('Unicorns\nRainbows', 4);
//=> '    Unicorns\n    Rainbows'

indentString('Unicorns\nRainbows', 4, {indent: '♥'});
//=> '♥♥♥♥Unicorns\n♥♥♥♥Rainbows'
```

## API

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

#### string

Type: `string`

The string to indent.

#### count

Type: `number`\
Default: `1`

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.

## Related

- [indent-string-cli](https://github.com/sindresorhus/indent-string-cli) - CLI for this module
- [strip-indent](https://github.com/sindresorhus/strip-indent) - Strip leading whitespace from every line in a string

---

<div align="center">
	<b>
		<a href="https://tidelift.com/subscription/pkg/npm-indent-string?utm_source=npm-indent-string&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/indent-string · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
