MCPcopy Create free account
hub / github.com/Rich-Harris/magic-string / getIndentString

Method getIndentString

src/Bundle.js:172–189  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

170 }
171
172 getIndentString() {
173 const indentStringCounts = {};
174
175 this.sources.forEach((source) => {
176 const indentStr = source.content._getRawIndentString();
177
178 if (indentStr === null) return;
179
180 if (!indentStringCounts[indentStr]) indentStringCounts[indentStr] = 0;
181 indentStringCounts[indentStr] += 1;
182 });
183
184 return (
185 Object.keys(indentStringCounts).sort((a, b) => {
186 return indentStringCounts[a] - indentStringCounts[b];
187 })[0] || '\t'
188 );
189 }
190
191 indent(indentStr) {
192 if (!arguments.length) {

Callers 2

indentMethod · 0.95

Calls 1

_getRawIndentStringMethod · 0.80

Tested by

no test coverage detected