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

Method getIndentString

src/Bundle.ts:229–248  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

227 }
228
229 getIndentString(): string {
230 const indentStringCounts = {}
231
232 this.sources.forEach((source) => {
233 const indentStr = source.content._getRawIndentString()
234
235 if (indentStr === null)
236 return
237
238 if (!indentStringCounts[indentStr])
239 indentStringCounts[indentStr] = 0
240 indentStringCounts[indentStr] += 1
241 })
242
243 return (
244 Object.keys(indentStringCounts).sort((a, b) => {
245 return indentStringCounts[a] - indentStringCounts[b]
246 })[0] || '\t'
247 )
248 }
249
250 indent(indentStr?: string): this {
251 if (!arguments.length) {

Callers 2

indentMethod · 0.95

Calls 1

_getRawIndentStringMethod · 0.80

Tested by

no test coverage detected