Skip to content

Commit bbfebd0

Browse files
committed
Fix linting errors
1 parent fed9e0e commit bbfebd0

File tree

5 files changed

+42
-41
lines changed

5 files changed

+42
-41
lines changed

src/data-structures/interval-tree.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,11 @@
151151
return contains(point, this.root);
152152
};
153153

154+
function intersects(a, b) {
155+
return (a[0] <= b[0] && a[1] >= b[0]) || (a[0] <= b[1] && a[1] >= b[1]) ||
156+
(b[0] <= a[0] && b[1] >= a[0]) || (b[0] <= a[1] && b[1] >= a[1]);
157+
}
158+
154159
function intersectsHelper(interval, node) {
155160
if (!node) {
156161
return false;
@@ -169,11 +174,6 @@
169174
return result;
170175
}
171176

172-
function intersects(a, b) {
173-
return (a[0] <= b[0] && a[1] >= b[0]) || (a[0] <= b[1] && a[1] >= b[1]) ||
174-
(b[0] <= a[0] && b[1] >= a[0]) || (b[0] <= a[1] && b[1] >= a[1]);
175-
}
176-
177177
/**
178178
* Checks or interval belongs to at least one intarval from the tree.<br><br>
179179
* Complexity: O(log N).

src/graphics/bresenham-line-drawing.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
(function (exports) {
22
'use strict';
33

4+
/**
5+
* Draws (prints) the given coordinates
6+
* @param {number} x The first coordinate of the point
7+
* @param {number} y The second coordinate of the point
8+
*/
9+
function drawPoint(x, y) {
10+
console.log(x, y);
11+
}
12+
413
/**
514
* Bresenham's line drawing algorithm.
615
* It has complexity O(n)
@@ -33,15 +42,6 @@
3342
}
3443
}
3544

36-
/**
37-
* Draws (prints) the given coordinates
38-
* @param {number} x The first coordinate of the point
39-
* @param {number} y The second coordinate of the point
40-
*/
41-
function drawPoint(x, y) {
42-
console.log(x, y);
43-
}
44-
4545
exports.drawLine = drawLine;
4646

4747
}(typeof exports === 'undefined' ? window : exports));

src/graphs/spanning-trees/prim.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,6 @@
7171
exports.Graph.prototype.prim = (function () {
7272
var queue;
7373

74-
/**
75-
* Initialize the algorithm.
76-
*
77-
* @private
78-
*/
79-
function init() {
80-
queue = new Heap(compareEdges);
81-
}
82-
8374
/**
8475
* Used for comparitions in the heap
8576
*
@@ -94,6 +85,15 @@
9485
return b.distance - a.distance;
9586
}
9687

88+
/**
89+
* Initialize the algorithm.
90+
*
91+
* @private
92+
*/
93+
function init() {
94+
queue = new Heap(compareEdges);
95+
}
96+
9797
return function () {
9898
init.call(this);
9999
var inTheTree = {};

src/searching/binarysearch.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
(function (exports) {
22
'use strict';
33

4+
function id (val) { return val; }
5+
function get (key) { return function (val) { return val[key]; }; }
6+
47
/**
58
* Searchs for specific element in a given array using
69
* the binary search algorithm.<br><br>
@@ -37,8 +40,6 @@
3740
}
3841
return -middle - 1;
3942
}
40-
function id (val) { return val; }
41-
function get (key) { return function (val) { return val[key]; }; }
4243

4344
exports.binarySearch = binarySearch;
4445

src/sorting/quicksort.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,22 @@
1313
return a - b;
1414
}
1515

16+
/**
17+
* Swap the places of two elements
18+
*
19+
* @private
20+
* @param {array} array The array which contains the elements
21+
* @param {number} i The index of the first element
22+
* @param {number} j The index of the second element
23+
* @returns {array} array The array with swaped elements
24+
*/
25+
function swap(array, i, j) {
26+
var temp = array[i];
27+
array[i] = array[j];
28+
array[j] = temp;
29+
return array;
30+
}
31+
1632
/**
1733
* Partitions given subarray using Lomuto's partitioning algorithm.
1834
*
@@ -35,22 +51,6 @@
3551
return minEnd;
3652
}
3753

38-
/**
39-
* Swap the places of two elements
40-
*
41-
* @private
42-
* @param {array} array The array which contains the elements
43-
* @param {number} i The index of the first element
44-
* @param {number} j The index of the second element
45-
* @returns {array} array The array with swaped elements
46-
*/
47-
function swap(array, i, j) {
48-
var temp = array[i];
49-
array[i] = array[j];
50-
array[j] = temp;
51-
return array;
52-
}
53-
5454
/**
5555
* Sorts given array.
5656
*

0 commit comments

Comments
 (0)