UNPKG

460 BJavaScriptView Raw
1"use strict";
2
3class BinaryTree
4{
5 constructor(options)
6 {
7 var value = options.value;
8 var children = options.children;
9 var left = children[0];
10 var right = children[1];
11
12 this.value = value;
13
14 if (left)
15 this.left = typeof left === "function" ? left() : left;
16
17 if (right)
18 this.right = typeof right === "function" ? right() : right;
19 }
20}
21
22module.exports = BinaryTree;