si

strip-indent

Strip leading whitespace from each line in a string

Showing:

Popularity

Downloads/wk

16M

GitHub Stars

118

Maintenance

Last Commit

3d ago

Contributors

6

Package

Dependencies

1

Size (min+gzip)

0.3KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

strip-indent

Strip leading whitespace from each line in a string

The line with the least number of leading whitespace, ignoring empty lines, determines the number to remove.

Useful for removing redundant indentation.

Install

$ npm install strip-indent

Usage

import stripIndent from 'strip-indent';

const string = '\tunicorn\n\t\tcake';
/*
    unicorn
        cake
*/

stripIndent(string);
/*
unicorn
    cake
*/

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.

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100