indent-string
Indent each line in a string
Last updated 8 months 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 (8 months ago)

15 Versions

  • 4.0.0                                ...           8 months ago
  • 3.2.0                                ...           2 years ago
  • 3.1.0                                ...           3 years ago
  • 3.0.0                                ...           3 years ago
  • 2.1.0                                ...           4 years ago
  • 2.0.0                                ...           4 years ago
  • 1.2.2                                ...           4 years ago
  • 1.2.1                                ...           5 years ago
  • 1.2.0                                ...           5 years ago
  • 1.1.0                                ...           5 years ago
  • 1.0.0                                ...           5 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 17,765
This Week 139,726
This Month 313,708
Last Day 30,310
Last Week 165,412
Last Month 684,472
Dependencies (0)
None
Dev Dependencies (3)
Dependents (430)

Copyright 2014 - 2016 © taobao.org |