index.js 257 B

1234567891011121314
  1. 'use strict';
  2. const minIndent = require('min-indent');
  3. module.exports = string => {
  4. const indent = minIndent(string);
  5. if (indent === 0) {
  6. return string;
  7. }
  8. const regex = new RegExp(`^[ \\t]{${indent}}`, 'gm');
  9. return string.replace(regex, '');
  10. };