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

Method _setSubparticles

external/.scrollLibs.js:16547–16564  ·  view source on GitHub ↗
(content, circularCheckArray)

Source from the content-addressed store, hash-verified

16545 return this
16546 }
16547 _setSubparticles(content, circularCheckArray) {
16548 this._clearSubparticles()
16549 // todo: is this correct? seems like `new Particle("").length` should be 1, not 0.
16550 if (!content) return this
16551 // set from string
16552 if (typeof content === "string") {
16553 this._appendSubparticlesFromString(content)
16554 return this
16555 }
16556 // set from particle
16557 if (content instanceof Particle) {
16558 content.forEach(particle => this._insertBlock(particle.toString()))
16559 return this
16560 }
16561 // If we set from object, create an array of inserted objects to avoid circular loops
16562 if (!circularCheckArray) circularCheckArray = [content]
16563 return this._setFromObject(content, circularCheckArray)
16564 }
16565 _setFromObject(content, circularCheckArray) {
16566 for (let cue in content) {
16567 if (!content.hasOwnProperty(cue)) continue

Callers 5

constructorMethod · 0.95
setSubparticlesMethod · 0.95
setFromTextMethod · 0.95

Calls 6

_clearSubparticlesMethod · 0.95
_insertBlockMethod · 0.95
_setFromObjectMethod · 0.95
forEachMethod · 0.80
toStringMethod · 0.45

Tested by

no test coverage detected