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

Method _transformAndAppendBlockAsync

external/.scrollLibs.js:16633–16649  ·  view source on GitHub ↗
(block)

Source from the content-addressed store, hash-verified

16631 await parserPool.appendParticleAsync(this, block)
16632 }
16633 async _transformAndAppendBlockAsync(block) {
16634 block = block.replace(/\r/g, "") // I hate \r
16635 const rootParticle = this.root
16636 if (this._beforeAppend) this._beforeAppend(block) // todo: clean this up and document it.
16637 if (rootParticle.particleTransformers) {
16638 // A macro may return multiple new blocks.
16639 const blocks = splitBlocks(rootParticle._transformBlock(block), SUBPARTICLE_MEMBRANE, PARTICLE_MEMBRANE)
16640 const newParticles = []
16641 for (const [newBlockIndex, block] of blocks.entries()) {
16642 const particle = await this._appendBlockAsync(block)
16643 newParticles.push(particle)
16644 }
16645 return newParticles[0]
16646 }
16647 const newParticle = await this._appendBlockAsync(block)
16648 return newParticle
16649 }
16650 async appendFromStream(input) {
16651 var _a, e_1, _b, _c
16652 const { edgeSymbol, particleBreakSymbol } = this

Callers 1

appendFromStreamMethod · 0.95

Calls 4

_appendBlockAsyncMethod · 0.95
splitBlocksFunction · 0.85
replaceMethod · 0.80
_transformBlockMethod · 0.80

Tested by

no test coverage detected