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

Method getIndentString

src/Bundle.ts:254–273  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

252 }
253
254 getIndentString(): string {
255 const indentStringCounts = {}
256
257 this.sources.forEach((source) => {
258 const indentStr = source.content._getRawIndentString()
259
260 if (indentStr === null)
261 return
262
263 if (!indentStringCounts[indentStr])
264 indentStringCounts[indentStr] = 0
265 indentStringCounts[indentStr] += 1
266 })
267
268 return (
269 Object.keys(indentStringCounts).sort((a, b) => {
270 return indentStringCounts[b] - indentStringCounts[a]
271 })[0] || '\t'
272 )
273 }
274
275 indent(indentStr?: string): this {
276 if (!arguments.length) {

Callers 3

indentMethod · 0.95
Bundle.test.tsFile · 0.45
indent.test.tsFile · 0.45

Calls 1

_getRawIndentStringMethod · 0.80

Tested by

no test coverage detected