Skip to content

Commit 4e9ec58

Browse files
committed
Fix linting errors
1 parent f6a0411 commit 4e9ec58

File tree

2 files changed

+26
-18
lines changed

2 files changed

+26
-18
lines changed

src/data-structures/binary-search-tree.js

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,25 +36,25 @@
3636
* @param {Node} right Right sibling.
3737
* @param {Node} parent Parent of the node.
3838
*/
39-
exports.Node = function(value, left, right, parent) {
39+
exports.Node = function (value, left, right, parent) {
4040
/**
4141
* @member {Number|String}
4242
*/
4343
this.value = value;
4444
this._left = left;
4545
this._right = right;
4646
this._parent = parent;
47-
}
47+
};
4848

4949
/**
5050
* Binary tree.
5151
*
5252
* @public
5353
* @constructor
5454
*/
55-
exports.BinaryTree = function() {
55+
exports.BinaryTree = function () {
5656
this._root = null;
57-
}
57+
};
5858

5959
/**
6060
* Inserts a node into the binary search tree.<br><br>
@@ -90,7 +90,8 @@
9090
*
9191
* @private
9292
* @param {Node} current Node from which to start the traversal.
93-
* @param {Function} callback Callback which will be called for each traversed node.
93+
* @param {Function} callback Callback which
94+
* will be called for each traversed node.
9495
*/
9596
exports.BinaryTree.prototype._inorder = function (current, callback) {
9697
if (!current) {
@@ -108,7 +109,8 @@
108109
*
109110
* @public
110111
* @method
111-
* @param {Function} callback Callback which will be called for each traversed node.
112+
* @param {Function} callback Callback which will
113+
* be called for each traversed node.
112114
*/
113115
exports.BinaryTree.prototype.inorder = function (callback) {
114116
return this._inorder(this._root, callback);
@@ -119,7 +121,8 @@
119121
*
120122
* @private
121123
* @param {Node} current Node from which to start the traversal.
122-
* @param {Function} callback Callback which will be called for each traversed node.
124+
* @param {Function} callback Callback which will
125+
* be called for each traversed node
123126
*/
124127
exports.BinaryTree.prototype._postorder = function (current, callback) {
125128
if (!current) {
@@ -136,7 +139,8 @@
136139
* Post-order traversal of the whole tree.
137140
*
138141
* @public
139-
* @param {Function} callback Callback which will be called for each traversed node.
142+
* @param {Function} callback Callback which will
143+
* be called for each traversed node.
140144
*/
141145
exports.BinaryTree.prototype.postorder = function (callback) {
142146
return this._postorder(this._root, callback);
@@ -147,7 +151,8 @@
147151
*
148152
* @private
149153
* @param {Node} current Node from which to start the traversal.
150-
* @param {Function} callback Callback which will be called for each traversed node.
154+
* @param {Function} callback Callback which will
155+
* be called for each traversed node.
151156
*/
152157
exports.BinaryTree.prototype._preorder = function (current, callback) {
153158
if (!current) {
@@ -162,9 +167,10 @@
162167

163168
/**
164169
* Pre-order preorder traversal of the whole tree.
165-
*
170+
*
166171
* @public
167-
* @param {Function} callback Callback which will be called for each traversed node.
172+
* @param {Function} callback Callback which will be
173+
* called for each traversed node.
168174
*/
169175
exports.BinaryTree.prototype.preorder = function (callback) {
170176
return this._preorder(this._root, callback);
@@ -215,7 +221,8 @@
215221
* @param {Node} oldChild Child to be replaced.
216222
* @param {Node} newChild Child replacement.
217223
*/
218-
exports.BinaryTree.prototype._replaceChild = function (parent, oldChild, newChild) {
224+
exports.BinaryTree.prototype._replaceChild =
225+
function (parent, oldChild, newChild) {
219226
if (!parent) {
220227
this._root = newChild;
221228
this._root._parent = null;

src/data-structures/heap.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
/**
2-
* A binary heap is a complete binary tree which satisfies the heap ordering property.
3-
*
2+
* A binary heap is a complete binary tree which
3+
* satisfies the heap ordering property.
4+
*
45
* @example
56
* var Heap = require('path-to-algorithms/src/data-structures/heap').Heap;
6-
*
7+
*
78
* var heap = new Heap(function(a, b) {
89
* return a.birthyear - b.birthyear;
910
* });
10-
*
11+
*
1112
* heap.add({
1213
* name: 'John',
1314
* birthyear: 1981
@@ -48,7 +49,7 @@
4849
* @constructor
4950
* @param {Function} cmp Function used for comparition between the elements.
5051
*/
51-
exports.Heap = function(cmp) {
52+
exports.Heap = function (cmp) {
5253
this._heap = [];
5354
if (typeof cmp === 'function') {
5455
this._cmp = cmp;
@@ -57,7 +58,7 @@
5758
return a - b;
5859
};
5960
}
60-
}
61+
};
6162

6263
/**
6364
* Exchange indexes with start index given as argument

0 commit comments

Comments
 (0)