Skip to content

Commit 9d1b51f

Browse files
Run tests
1 parent eb0a212 commit 9d1b51f

File tree

13 files changed

+982
-1021
lines changed

13 files changed

+982
-1021
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ for (const node of tree) {
6161

6262
## Complete Documentation
6363
Checkout [DOCUMENTATION.md](DOCUMENTATION.md) for complete documentation or View Documentation online at [https://dsinjs.github.io/binary-tree/](https://dsinjs.github.io/binary-tree/)
64-
64+
> Note: May need to use polyfills for Array.entries(), to make BTree work in older browsers like IE11.
6565
6666
## Help us expand
6767
Let me know in issues/github page or on email which javascript functions to include in next release.

dist/btree.js

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -40,22 +40,8 @@ var __read = (this && this.__read) || function (o, n) {
4040
return ar;
4141
};
4242
Object.defineProperty(exports, "__esModule", { value: true });
43-
exports.BTree = exports.BTreeNodeStruct = exports.ExtendedWindow = void 0;
43+
exports.BTree = void 0;
4444
var btreenode_1 = require("./btreenode");
45-
var ExtendedWindow = /** @class */ (function (_super) {
46-
__extends(ExtendedWindow, _super);
47-
function ExtendedWindow() {
48-
return _super !== null && _super.apply(this, arguments) || this;
49-
}
50-
return ExtendedWindow;
51-
}(Window));
52-
exports.ExtendedWindow = ExtendedWindow;
53-
var BTreeNodeStruct = /** @class */ (function () {
54-
function BTreeNodeStruct() {
55-
}
56-
return BTreeNodeStruct;
57-
}());
58-
exports.BTreeNodeStruct = BTreeNodeStruct;
5945
var UnreachableError = /** @class */ (function (_super) {
6046
__extends(UnreachableError, _super);
6147
function UnreachableError(msg) {
@@ -75,12 +61,13 @@ var FilteredRootError = /** @class */ (function (_super) {
7561
return FilteredRootError;
7662
}(Error));
7763
// if Symbol is not available in window
78-
/* if (typeof window !== "undefined") {
79-
if (typeof Symbol === "undefined") {
80-
window.Symbol = {};
81-
window.Symbol.iterator = "==iterator==";
82-
}
83-
} */
64+
if (typeof window !== "undefined") {
65+
if (typeof Symbol === "undefined") {
66+
var win = window;
67+
win.Symbol = {};
68+
win.Symbol.iterator = "==iterator==";
69+
}
70+
}
8471
/**
8572
* BTree main class
8673
* @class

dist/btreenode.js

Lines changed: 7 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,6 @@
11
"use strict";
2-
var __extends = (this && this.__extends) || (function () {
3-
var extendStatics = function (d, b) {
4-
extendStatics = Object.setPrototypeOf ||
5-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7-
return extendStatics(d, b);
8-
};
9-
return function (d, b) {
10-
extendStatics(d, b);
11-
function __() { this.constructor = d; }
12-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13-
};
14-
})();
152
Object.defineProperty(exports, "__esModule", { value: true });
16-
exports.BTreeNode = exports.BTreeNodeStruct = exports.ExtendedWindow = void 0;
17-
var ExtendedWindow = /** @class */ (function (_super) {
18-
__extends(ExtendedWindow, _super);
19-
function ExtendedWindow() {
20-
return _super !== null && _super.apply(this, arguments) || this;
21-
}
22-
return ExtendedWindow;
23-
}(Window));
24-
exports.ExtendedWindow = ExtendedWindow;
25-
var BTreeNodeStruct = /** @class */ (function () {
26-
function BTreeNodeStruct() {
27-
}
28-
return BTreeNodeStruct;
29-
}());
30-
exports.BTreeNodeStruct = BTreeNodeStruct;
3+
exports.BTreeNode = void 0;
314
/**
325
* Binary Tree node class, contains 2 child nodes and single value.
336
* @class BTreeNode
@@ -45,13 +18,13 @@ var BTreeNode = /** @class */ (function () {
4518
*/
4619
function BTreeNode(attr) {
4720
this.value = attr.value || null;
48-
this.lNode = null;
49-
if (!attr.lNode instanceof BTreeNode && attr.lNode !== void 0 && attr.lNode !== null) {
50-
this.lNode = new BTreeNode(attr.lNode);
21+
this.lNode = attr.lNode || null;
22+
if (!this.lNode instanceof BTreeNode) {
23+
this.lNode = new BTreeNode(this.lNode);
5124
}
52-
this.rNode = null;
53-
if (!this.rNode instanceof BTreeNode && attr.rNode !== void 0 && attr.rNode !== null) {
54-
this.rNode = new BTreeNode(attr.rNode);
25+
this.rNode = attr.rNode || null;
26+
if (!this.rNode instanceof BTreeNode) {
27+
this.rNode = new BTreeNode(this.rNode);
5528
}
5629
if (!this.validate()) {
5730
throw new Error("A BTree node must have a valid value, cannot be null or undefined");

0 commit comments

Comments
 (0)