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

Method getIndentString

src/Bundle.ts:231–250  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

Callers 2

indentMethod · 0.95

Calls 1

_getRawIndentStringMethod · 0.80

Tested by

no test coverage detected