projects
/
dotfiles
/
.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
Update .bashrc
[dotfiles/.git]
/
.config
/
coc
/
extensions
/
node_modules
/
coc-prettier
/
node_modules
/
strip-indent
/
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
};