MCPcopy Create free account
hub / github.com/breck7/scroll / _insertLines

Method _insertLines

external/.scrollLibs.js:16608–16617  ·  view source on GitHub ↗
(lines, index = this.length)

Source from the content-addressed store, hash-verified

16606 return newParticle
16607 }
16608 _insertLines(lines, index = this.length) {
16609 const parser = this.constructor
16610 const newParticle = new parser()
16611 if (typeof lines === "string") newParticle._appendSubparticlesFromString(lines)
16612 const adjustedIndex = index < 0 ? this.length + index : index
16613 this._getSubparticlesArray().splice(adjustedIndex, 0, ...newParticle.getSubparticles())
16614 if (this._cueIndex) this._makeCueIndex(adjustedIndex)
16615 this.clearQuickCache()
16616 return this.getSubparticles().slice(index, index + newParticle.length)
16617 }
16618 insertLinesAfter(lines) {
16619 return this.parent._insertLines(lines, this.index + 1)
16620 }

Callers 1

insertLinesAfterMethod · 0.80

Calls 6

_getSubparticlesArrayMethod · 0.95
getSubparticlesMethod · 0.95
_makeCueIndexMethod · 0.95
clearQuickCacheMethod · 0.95
sliceMethod · 0.80

Tested by

no test coverage detected