()
| 480 | } |
| 481 | |
| 482 | #childrenArray() { |
| 483 | const ar = []; |
| 484 | const oldPush = ar.push; |
| 485 | ar.push = (...args) => { |
| 486 | args.forEach((item) => { |
| 487 | if (!(item instanceof Tree)) throw new Error("Invalid tree"); |
| 488 | item.parent = this; |
| 489 | oldPush.call(ar, item); |
| 490 | }); |
| 491 | }; |
| 492 | return ar; |
| 493 | } |
| 494 | |
| 495 | /** |
| 496 | * Create a tree |