projects
/
dotfiles
/
.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
8f8f4f444c82a66faf19f3ae256ae43055ee78cd
[dotfiles/.git]
/
index.js
1
'use strict';
2
module.exports = function (str) {
3
var match = str.match(/^[ \t]*(?=\S)/gm);
4
5
if (!match) {
6
return str;
7
}
8
9
var indent = Math.min.apply(Math, match.map(function (el) {
10
return el.length;
11
}));
12
13
var re = new RegExp('^[ \\t]{' + indent + '}', 'gm');
14
15
return indent > 0 ? str.replace(re, '') : str;
16
};