1 | import minIndent from 'min-indent';
|
2 |
|
3 | export default function stripIndent(string) {
|
4 | const indent = minIndent(string);
|
5 |
|
6 | if (indent === 0) {
|
7 | return string;
|
8 | }
|
9 |
|
10 | const regex = new RegExp(`^[ \\t]{${indent}}`, 'gm');
|
11 |
|
12 | return string.replace(regex, '');
|
13 | }
|