* @todo refactor this, this should use getContent only! * * Transforms this YArray to a JavaScript Array. * * @return {Array | delta.DeltaConfGetText >}
()
| 1264 | * @return {Array<delta.DeltaConfGetChildren<DConf> | delta.DeltaConfGetText<DConf>>} |
| 1265 | */ |
| 1266 | toArray () { |
| 1267 | const dcontent = this.toDelta() |
| 1268 | /** |
| 1269 | * @type {Array<any>} |
| 1270 | */ |
| 1271 | const children = [] |
| 1272 | for (const child of dcontent.children) { |
| 1273 | if (delta.$insertOp.check(child)) { |
| 1274 | children.push(...child.insert) |
| 1275 | } else if (delta.$textOp.check(child)) { |
| 1276 | children.push(child.insert) |
| 1277 | } |
| 1278 | } |
| 1279 | return children |
| 1280 | } |
| 1281 | |
| 1282 | /** |
| 1283 | * Transforms this Shared Type to a JSON object. |
no test coverage detected