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

Method _getParticlesByLineRegex

external/.scrollLibs.js:17181–17187  ·  view source on GitHub ↗
(matches, regs)

Source from the content-addressed store, hash-verified

17179 return this.filter(particle => particle.getLine().startsWith(prefix))
17180 }
17181 _getParticlesByLineRegex(matches, regs) {
17182 const rgs = regs.slice(0)
17183 const reg = rgs.shift()
17184 const candidates = this.filter(subparticle => subparticle.getLine().match(reg))
17185 if (!rgs.length) return candidates.forEach(cand => matches.push(cand))
17186 candidates.forEach(cand => cand._getParticlesByLineRegex(matches, rgs))
17187 }
17188 concat(particle) {
17189 if (typeof particle === "string") particle = new Particle(particle)
17190 return particle.map(particle => this._insertBlock(particle.toString()))

Callers 2

getParticlesByRegexMethod · 0.95

Calls 5

filterMethod · 0.95
sliceMethod · 0.80
shiftMethod · 0.80
forEachMethod · 0.80
getLineMethod · 0.45

Tested by

no test coverage detected