redent
TypeScript icon, indicating that this package has built-in type declarations

4.0.0 • Public • Published

redent

Strip redundant indentation and indent the string

Install

$ npm install redent

Usage

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.


Get professional support for this package with a Tidelift subscription
Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 4.0.0
    1,746,181
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 4.0.0
    1,746,181
  • 3.0.0
    14,528,255
  • 2.0.0
    1,220,651
  • 1.0.0
    3,558,645

Package Sidebar

Install

npm i redent

Weekly Downloads

16,977,900

Version

4.0.0

License

MIT

Unpacked Size

3.85 kB

Total Files

5

Last publish

Collaborators

  • sindresorhus