Skip to content

Commit 286160e

Browse files
committed
Fix jshint warnings in demo.js
1 parent 30e1032 commit 286160e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

demo/demo.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ var generateRandom = function (width, height, wallFrequency) {
2121

2222
for (var y = 0; y < height; y++) {
2323
var isWall = Math.floor(Math.random()*(1/wallFrequency));
24-
if (isWall == 0) {
24+
if (isWall === 0) {
2525
nodeRow.push(WALL);
2626
}
2727
else {
@@ -96,7 +96,7 @@ var css = { start: "start", finish: "finish", wall: "wall", active: "active" };
9696
function GraphSearch($graph, options, implementation) {
9797
this.$graph = $graph;
9898
this.search = implementation;
99-
this.opts = $.extend({wallFrequency:.1, debug:true, gridSize:10}, options);
99+
this.opts = $.extend({wallFrequency:0.1, debug:true, gridSize:10}, options);
100100
this.initialize();
101101
}
102102
GraphSearch.prototype.setOption = function(opt) {
@@ -131,7 +131,7 @@ GraphSearch.prototype.initialize = function() {
131131
gridRow.push($cell);
132132

133133
var isWall = Math.floor(Math.random()*(1/self.opts.wallFrequency));
134-
if(isWall == 0) {
134+
if(isWall === 0) {
135135
nodeRow.push(WALL);
136136
$cell.addClass(css.wall);
137137
}
@@ -184,7 +184,7 @@ GraphSearch.prototype.cellClicked = function($end) {
184184
var fTime = performance ? performance.now() : new Date().getTime(),
185185
duration = (fTime-sTime).toFixed(2);
186186

187-
if(!path || path.length == 0) {
187+
if(path.length === 0) {
188188
$("#message").text("couldn't find a path (" + duration + "ms)");
189189
this.animateNoPath();
190190
}
@@ -239,7 +239,7 @@ GraphSearch.prototype.animatePath = function(path) {
239239
var self = this;
240240
// will add start class if final
241241
var removeClass = function(path, i) {
242-
if(i>=path.length){ // finished removing path, set start positions
242+
if(i >= path.length) { // finished removing path, set start positions
243243
return setStartClass(path, i);
244244
}
245245
elementFromNode(path[i]).removeClass(css.active);
@@ -254,7 +254,7 @@ GraphSearch.prototype.animatePath = function(path) {
254254
}
255255
};
256256
var addClass = function(path, i) {
257-
if(i>=path.length) { // Finished showing path, now remove
257+
if(i >= path.length) { // Finished showing path, now remove
258258
return removeClass(path, 0);
259259
}
260260
elementFromNode(path[i]).addClass(css.active);

0 commit comments

Comments
 (0)