vlad 6f123ff03e 18.07 | vor 6 Jahren | |
---|---|---|
.. | ||
cli.js | vor 6 Jahren | |
index.js | vor 6 Jahren | |
license | vor 6 Jahren | |
package.json | vor 6 Jahren | |
readme.md | vor 6 Jahren |
Strip leading whitespace from every 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.
$ npm install --save strip-indent
var str = '\tunicorn\n\t\tcake';
/*
unicorn
cake
*/
stripIndent('\tunicorn\n\t\tcake');
/*
unicorn
cake
*/
$ npm install --global strip-indent
$ strip-indent --help
Usage
strip-indent <file>
echo <string> | strip-indent
Example
echo '\tunicorn\n\t\tcake' | strip-indent
unicorn
cake
MIT © Sindre Sorhus