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

Method getIndentString

src/Bundle.ts:389–408  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

387 }
388
389 getIndentString(): string {
390 const indentStringCounts = {}
391
392 this.sources.forEach((source) => {
393 const indentStr = source.content._getRawIndentString()
394
395 if (indentStr === null)
396 return
397
398 if (!indentStringCounts[indentStr])
399 indentStringCounts[indentStr] = 0
400 indentStringCounts[indentStr] += 1
401 })
402
403 return (
404 Object.keys(indentStringCounts).sort((a, b) => {
405 return indentStringCounts[b] - indentStringCounts[a]
406 })[0] || '\t'
407 )
408 }
409
410 indent(indentStr?: string): this {
411 if (!arguments.length) {

Callers 3

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

Calls 1

_getRawIndentStringMethod · 0.80

Tested by

no test coverage detected