Skip to content

Commit 0556df2

Browse files
Fix BTree Symbol issue in ES5
1 parent 0ddb73e commit 0556df2

File tree

4 files changed

+29
-3
lines changed

4 files changed

+29
-3
lines changed

dist/dsinjs-binarytree.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,16 @@ var FilteredRootError = function (_Error2) {
225225
return FilteredRootError;
226226
}(Error);
227227

228+
// if Symbol is not available in window
229+
230+
231+
if (typeof window !== "undefined") {
232+
if (typeof Symbol === "undefined") {
233+
window.Symbol = {};
234+
window.Symbol.iterator = "==iterator==";
235+
}
236+
}
237+
228238
/**
229239
* BTree main class
230240
* @class
@@ -235,7 +245,6 @@ var FilteredRootError = function (_Error2) {
235245
* new BTree({ value: 10 });
236246
*/
237247

238-
239248
var BTree = function () {
240249
/**
241250
* Constructor for Binary Tree.

dist/dsinjs-binarytree.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,16 @@ var FilteredRootError = function (_Error2) {
6161
return FilteredRootError;
6262
}(Error);
6363

64+
// if Symbol is not available in window
65+
66+
67+
if (typeof window !== "undefined") {
68+
if (typeof Symbol === "undefined") {
69+
window.Symbol = {};
70+
window.Symbol.iterator = "==iterator==";
71+
}
72+
}
73+
6474
/**
6575
* BTree main class
6676
* @class
@@ -71,7 +81,6 @@ var FilteredRootError = function (_Error2) {
7181
* new BTree({ value: 10 });
7282
*/
7383

74-
7584
var BTree = function () {
7685
/**
7786
* Constructor for Binary Tree.

src/index.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@ class FilteredRootError extends Error {
3131
}
3232
}
3333

34+
// if Symbol is not available in window
35+
if (typeof window !== "undefined") {
36+
if (typeof Symbol === "undefined") {
37+
window.Symbol = {};
38+
window.Symbol.iterator = "==iterator==";
39+
}
40+
}
41+
3442
/**
3543
* BTree main class
3644
* @class

0 commit comments

Comments
 (0)