98dcd8d3a18b8f2d410d483aff9157185ad649953a5e911b85b30922c1ca4dc27d1995381983b06c5f6472d4da159101db46375c6c70ed5d744cab3f097a30 862 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 each 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. ```
  7. $ npm install --save strip-indent
  8. ```
  9. ## Usage
  10. ```js
  11. const stripIndent = require('strip-indent');
  12. const str = '\tunicorn\n\t\tcake';
  13. /*
  14. unicorn
  15. cake
  16. */
  17. stripIndent('\tunicorn\n\t\tcake');
  18. /*
  19. unicorn
  20. cake
  21. */
  22. ```
  23. ## Related
  24. - [strip-indent-cli](https://github.com/sindresorhus/strip-indent-cli) - CLI for this module
  25. - [indent-string](https://github.com/sindresorhus/indent-string) - Indent each line in a string
  26. ## License
  27. MIT © [Sindre Sorhus](https://sindresorhus.com)