MCPcopy
hub / github.com/esamattis/underscore.string / getIndent

Function getIndent

dedent.js:3–12  ·  view source on GitHub ↗
(str)

Source from the content-addressed store, hash-verified

1var makeString = require('./helper/makeString');
2
3function getIndent(str) {
4 var matches = str.match(/^[\s\\t]*/gm);
5 var indent = matches[0].length;
6
7 for (var i = 1; i < matches.length; i++) {
8 indent = Math.min(matches[i].length, indent);
9 }
10
11 return indent;
12}
13
14module.exports = function dedent(str, pattern) {
15 str = makeString(str);

Callers 1

dedent.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…