(delimiter = ".")
| 15991 | // Flatten a particle into an object like {twitter:"pldb", "twitter.followers":123}. |
| 15992 | // Assumes you have a nested key/value list with no multiline strings. |
| 15993 | toFlatObject(delimiter = ".") { |
| 15994 | let newObject = {} |
| 15995 | const { edgeSymbolRegex } = this |
| 15996 | this.forEach((subparticle, index) => { |
| 15997 | newObject[subparticle.getAtom(0)] = subparticle.content |
| 15998 | subparticle.topDownArray.forEach(particle => { |
| 15999 | const newColumnName = particle.getCuePathRelativeTo(this).replace(edgeSymbolRegex, delimiter) |
| 16000 | const value = particle.content |
| 16001 | newObject[newColumnName] = value |
| 16002 | }) |
| 16003 | }) |
| 16004 | return newObject |
| 16005 | } |
| 16006 | _toObject() { |
| 16007 | const obj = {} |
| 16008 | this.forEach(particle => { |
nothing calls this directly
no test coverage detected