strip-indent
Strip leading whitespace from each line in a string
Last updated a year 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 (a year ago)

8 Versions

  • 3.0.0                                ...           a year ago
  • 2.0.0                                ...           4 years ago
  • 1.0.1                                ...           5 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 2,069
This Week 2,069
This Month 2,069
Last Day 11,441
Last Week 207,064
Last Month 806,658
Dependencies (1)
Dev Dependencies (3)
Dependents (269)

Copyright 2014 - 2016 © taobao.org |