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

Method getIndentString

src/Bundle.ts:233–252  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

Callers 2

indentMethod · 0.95

Calls 1

_getRawIndentStringMethod · 0.80

Tested by

no test coverage detected