MCPcopy Create free account
hub / github.com/Thinkmill/react-markings / stripIndent

Function stripIndent

index.js:11–27  ·  view source on GitHub ↗
(str)

Source from the content-addressed store, hash-verified

9
10// Source: https://github.com/sindresorhus/strip-indent
11function stripIndent(str) {
12 var match = str.match(/^[ \t]*(?=\S)/gm);
13 if (!match) {
14 return str;
15 }
16
17 var indent = Math.min.apply(Math, match.map(function (x) {
18 return x.length;
19 }));
20
21 if (indent === 0) {
22 return str;
23 }
24
25 var re = new RegExp('^[ \\t]{' + indent + '}', 'gm');
26 return str.replace(re, '');
27}
28
29function validate(node) {
30 var isValid = true;

Callers 1

customizeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected