indent-string
Indent each line in a string
Last updated a year ago by sindresorhus .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install indent-string 
SYNC missed versions from official npm registry.

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.

Related

License

MIT © Sindre Sorhus

Current Tags

  • 4.0.0                                ...           latest (a year ago)

15 Versions

  • 4.0.0                                ...           a year ago
  • 3.2.0                                ...           3 years ago
  • 3.1.0                                ...           3 years ago
  • 3.0.0                                ...           4 years ago
  • 2.1.0                                ...           5 years ago
  • 2.0.0                                ...           5 years ago
  • 1.2.2                                ...           5 years ago
  • 1.2.1                                ...           5 years ago
  • 1.2.0                                ...           5 years ago
  • 1.1.0                                ...           6 years ago
  • 1.0.0                                ...           6 years ago
  • 0.1.3                                ...           6 years ago
  • 0.1.2                                ...           6 years ago
  • 0.1.1                                ...           6 years ago
  • 0.1.0                                ...           6 years ago
Maintainers (1)
Downloads
Today 6,887
This Week 6,887
This Month 155,590
Last Day 13,978
Last Week 230,648
Last Month 963,388
Dependencies (0)
None
Dev Dependencies (3)
Dependents (452)

Copyright 2014 - 2017 © taobao.org |