https://github.com/sindresorhus/strip-indent
  
  
    Strip leading whitespace from each line in a string 
    https://github.com/sindresorhus/strip-indent
  
        Last synced: 7 months ago 
        JSON representation
    
Strip leading whitespace from each line in a string
- Host: GitHub
 - URL: https://github.com/sindresorhus/strip-indent
 - Owner: sindresorhus
 - License: mit
 - Created: 2014-03-29T14:15:08.000Z (over 11 years ago)
 - Default Branch: main
 - Last Pushed: 2021-09-17T11:46:19.000Z (about 4 years ago)
 - Last Synced: 2024-10-29T12:58:11.680Z (about 1 year ago)
 - Language: JavaScript
 - Homepage:
 - Size: 23.4 KB
 - Stars: 135
 - Watchers: 8
 - Forks: 18
 - Open Issues: 1
 - 
            Metadata Files:
            
- Readme: readme.md
 - Funding: .github/funding.yml
 - License: license
 - Security: .github/security.md
 
 
Awesome Lists containing this project
- awesome-nodejs - strip-indent - Strip leading whitespace from every line in a string. (Repository / Text/String)
 - awesome-nodejs - strip-indent - Strip leading whitespace from every line in a string. (Packages / Text)
 - awesome-node - strip-indent - Strip leading whitespace from every line in a string. (Packages / Text)
 - awesome-nodejs-cn - strip-indent - 从字符串的每一行中除去前导空格. (目录 / 文本处理)
 - awesome-nodejs - strip-indent - Strip leading whitespace from each line in a string - ★ 77 (Text)
 - awesome-nodejs-cn - strip-indent - **star:136** 从字符串中的每一行中去除前导空格 (包 / 文本)
 - awesome-nodejs-cn - strip-indent - 从字符串的每一行中除去前导空格. (包 / 文本)
 - fucking-awesome-nodejs - strip-indent - Strip leading whitespace from every line in a string. (Packages / Text)
 - fucking-awesome-nodejs - strip-indent - Strip leading whitespace from every line in a string. (Packages / Text)
 
README
          # strip-indent
> 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
```js
import stripIndent from 'strip-indent';
const string = '\tunicorn\n\t\tcake';
/*
	unicorn
		cake
*/
stripIndent(string);
/*
unicorn
	cake
*/
```
## Related
- [strip-indent-cli](https://github.com/sindresorhus/strip-indent-cli) - CLI for this module
- [indent-string](https://github.com/sindresorhus/indent-string) - Indent each line in a string
- [redent](https://github.com/sindresorhus/redent) - Strip redundant indentation and indent the string
---
	
		Get professional support for this package with a Tidelift subscription
	
	
	
		Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.