strip-indent
Strip leading whitespace from each line in a string
Last updated 6 months ago by sindresorhus .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install strip-indent 
SYNC missed versions from official npm registry.

strip-indent Build Status

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

const stripIndent = require('strip-indent');

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

stripIndent(string);
/*
unicorn
	cake
*/

Related

License

MIT © Sindre Sorhus

Current Tags

  • 3.0.0                                ...           latest (6 months ago)

8 Versions

  • 3.0.0                                ...           6 months ago
  • 2.0.0                                ...           4 years ago
  • 1.0.1                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
  • 0.1.3                                ...           5 years ago
  • 0.1.2                                ...           6 years ago
  • 0.1.1                                ...           6 years ago
  • 0.1.0                                ...           6 years ago
Maintainers (1)
Downloads
Today 813
This Week 42,120
This Month 304,396
Last Day 21,193
Last Week 110,519
Last Month 461,928
Dependencies (1)
Dev Dependencies (3)
Dependents (237)

Copyright 2014 - 2016 © taobao.org |