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

Method typedTuple

external/.scrollLibs.js:18538–18561  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

18536 return this.content
18537 }
18538 get typedTuple() {
18539 const key = this.cue
18540 if (this.subparticlesAreTextBlob) return [key, this.subparticlesToString()]
18541 const { typedContent, contentKey, subparticlesKey } = this
18542 if (contentKey || subparticlesKey) {
18543 let obj = {}
18544 if (subparticlesKey) obj[subparticlesKey] = this.subparticlesToString()
18545 else obj = this.typedMap
18546 if (contentKey) {
18547 obj[contentKey] = typedContent
18548 }
18549 return [key, obj]
18550 }
18551 const hasSubparticles = this.length > 0
18552 const hasSubparticlesNoContent = typedContent === undefined && hasSubparticles
18553 const shouldReturnValueAsObject = hasSubparticlesNoContent
18554 if (shouldReturnValueAsObject) return [key, this.typedMap]
18555 const hasSubparticlesAndContent = typedContent !== undefined && hasSubparticles
18556 const shouldReturnValueAsContentPlusSubparticles = hasSubparticlesAndContent
18557 // If the particle has a content and a subparticle return it as a string, as
18558 // Javascript object values can't be both a leaf and a particle.
18559 if (shouldReturnValueAsContentPlusSubparticles) return [key, this.contentWithSubparticles]
18560 return [key, typedContent]
18561 }
18562 get _shouldSerialize() {
18563 const should = this.shouldSerialize
18564 return should === undefined ? true : should

Callers

nothing calls this directly

Calls 1

subparticlesToStringMethod · 0.80

Tested by

no test coverage detected