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

Method trimStart

src/Bundle.ts:324–341  ·  view source on GitHub ↗
(charType?: string)

Source from the content-addressed store, hash-verified

322 }
323
324 trimStart(charType?: string): this {
325 const rx = new RegExp(`^${charType || '\\s'}+`)
326 this.intro = this.intro.replace(rx, '')
327
328 if (!this.intro) {
329 let source
330 let i = 0
331
332 do {
333 source = this.sources[i++]
334 if (!source) {
335 break
336 }
337 } while (!source.content.trimStartAborted(charType))
338 }
339
340 return this
341 }
342
343 trimEnd(charType?: string): this {
344 const rx = new RegExp(`${charType || '\\s'}+$`)

Callers 1

trimMethod · 0.95

Calls 2

replaceMethod · 0.45
trimStartAbortedMethod · 0.45

Tested by

no test coverage detected