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

Method replaceParticle

external/.scrollLibs.js:17281–17292  ·  view source on GitHub ↗
(fn)

Source from the content-addressed store, hash-verified

17279 return newParticles
17280 }
17281 replaceParticle(fn) {
17282 const parent = this.parent
17283 const index = this.index
17284 const newParticles = new Particle(fn(this.toString()))
17285 const returnedParticles = []
17286 newParticles.forEach((subparticle, subparticleIndex) => {
17287 const newParticle = parent.insertLineAndSubparticles(subparticle.getLine(), subparticle.subparticlesToString(), index + subparticleIndex)
17288 returnedParticles.push(newParticle)
17289 })
17290 this.destroy()
17291 return returnedParticles
17292 }
17293 insertLineAndSubparticles(line, subparticles, index) {
17294 return this._insertBlock(this._makeBlock(line, subparticles), index)
17295 }

Callers 2

macroExpandMethod · 0.80

Calls 7

toStringMethod · 0.95
forEachMethod · 0.95
destroyMethod · 0.95
fnFunction · 0.85
subparticlesToStringMethod · 0.80
getLineMethod · 0.45

Tested by

no test coverage detected