You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

readme.md 957B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. # strip-indent [![Build Status](https://travis-ci.org/sindresorhus/strip-indent.svg?branch=master)](https://travis-ci.org/sindresorhus/strip-indent)
  2. > Strip leading whitespace from every line in a string
  3. The line with the least number of leading whitespace, ignoring empty lines, determines the number to remove.
  4. Useful for removing redundant indentation.
  5. ## Install
  6. ```sh
  7. $ npm install --save strip-indent
  8. ```
  9. ## Usage
  10. ```js
  11. var str = '\tunicorn\n\t\tcake';
  12. /*
  13. unicorn
  14. cake
  15. */
  16. stripIndent('\tunicorn\n\t\tcake');
  17. /*
  18. unicorn
  19. cake
  20. */
  21. ```
  22. ## CLI
  23. ```sh
  24. $ npm install --global strip-indent
  25. ```
  26. ```sh
  27. $ strip-indent --help
  28. Usage
  29. strip-indent <file>
  30. echo <string> | strip-indent
  31. Example
  32. echo '\tunicorn\n\t\tcake' | strip-indent
  33. unicorn
  34. cake
  35. ```
  36. ## Related
  37. - [indent-string](https://github.com/sindresorhus/indent-string) - Indent each line in a string
  38. ## License
  39. MIT © [Sindre Sorhus](http://sindresorhus.com)