indent-string (4.0.0)

Published 2026-02-24 13:58:08 +00:00 by atheaadmin

Installation

registry=
npm install indent-string@4.0.0
"indent-string": "4.0.0"

About this package

indent-string Build Status

Indent each line in a string

Install

$ npm install indent-string

Usage

const indentString = require('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.

License

MIT © Sindre Sorhus

Dependencies

Development Dependencies

ID Version
ava ^1.4.1
tsd ^0.7.2
xo ^0.24.0

Keywords

indent string pad align line text each every
Details
npm
2026-02-24 13:58:08 +00:00
0
Sindre Sorhus
MIT
2.0 KiB
Assets (1)
Versions (2) View all
4.0.0 2026-02-24
5.0.0 2026-02-24