2 module.exports = str => {
3 const match = str.match(/^[ \t]*(?=\S)/gm);
9 // TODO: use spread operator when targeting Node.js 6
10 const indent = Math.min.apply(Math, match.map(x => x.length)); // eslint-disable-line
11 const re = new RegExp(`^[ \\t]{${indent}}`, 'gm');
13 return indent > 0 ? str.replace(re, '') : str;