Skip to content

Commit

Permalink
Downgrade to version 2.4 of jshint and fix errors
Browse files Browse the repository at this point in the history
  • Loading branch information
felipernb committed Jun 5, 2014
1 parent 0d21ee3 commit 64de214
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 37 deletions.
40 changes: 20 additions & 20 deletions algorithms/math/extended_euclidean.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,30 +33,30 @@
* @return {Number, Number}
*/
var extEuclid = function (a, b) {
var s = 0, oldS = 1;
var t = 1, oldT = 0;
var r = b, oldR = a;
var quotient, temp;
while (r !== 0) {
quotient = Math.floor(oldR / r);
var s = 0, oldS = 1;
var t = 1, oldT = 0;
var r = b, oldR = a;
var quotient, temp;
while (r !== 0) {
quotient = Math.floor(oldR / r);

temp = r;
r = oldR - quotient * r;
oldR = temp;
temp = r;
r = oldR - quotient * r;
oldR = temp;

temp = s;
s = oldS - quotient * s;
oldS = temp;
temp = s;
s = oldS - quotient * s;
oldS = temp;

temp = t;
t = oldT - quotient * t;
oldT = temp;
}
temp = t;
t = oldT - quotient * t;
oldT = temp;
}

return {
x: oldS,
y: oldT
};
return {
x: oldS,
y: oldT
};
};

module.exports = extEuclid;
6 changes: 3 additions & 3 deletions algorithms/string/knuth_morris_pratt.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
* Asymptotic Complexity: O(text.length)
*
* @param {Array} of Numbers, Strings or Characters
* or {Strig}
* or {String}
* @param {Array} of Numbers, Strings or Characters
* or {Strig}
* or {String}
* @return {Number}
*/
var knuthMorrisPratt = function (text, pattern) {
Expand Down Expand Up @@ -72,7 +72,7 @@ var knuthMorrisPratt = function (text, pattern) {
* Asymptotic Complexity: O(pattern.length)
*
* @param {Array} of Numbers, Strings or Characters
* or {Strig}
* or {String}
* @return {Array} of Integers
*/
var buildTable = function (pattern) {
Expand Down
7 changes: 3 additions & 4 deletions data_structures/hash_table.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ HashTable.prototype.get = function (key) {
var i = this._position(key);
var node;
if ((node = this._findInList(this._table[i], key))) {
return node.value.v;
return node.value.v;
}
};

Expand Down Expand Up @@ -85,9 +85,8 @@ HashTable.prototype.del = function (key) {
var node;

if ((node = this._findInList(this._table[i], key))) {

this._table[i].delNode(node);
this._items--;
this._table[i].delNode(node);
this._items--;
}
};

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"devDependencies": {
"coveralls": "^2.10.0",
"istanbul": "^0.2.10",
"jshint": "^2.5.1",
"jshint": "~2.4.4",
"mocha": "^1.20.0"
},
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion test/algorithms/math/gcd.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe('GCD', function () {
assert.equal(gcdb(7, 49), 7);
assert.equal(gcdb(7, 5), 1);
assert.equal(gcdb(35, 49), 7);
});
});
});


12 changes: 6 additions & 6 deletions test/algorithms/sorting/counting_sort.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ var array = [

describe('Counting Sort', function () {
it('should sort the given array', function () {
array = countingSort(array);
array = countingSort(array);

// Asserts that the array is truly sorted
assert.deepEqual(array.indexOf(firstObject), 0);
assert.deepEqual(array.indexOf(secondObject), 4);
assert.deepEqual(array.indexOf(thirdObject), 3);
assert.deepEqual(array.indexOf({key: 99}), -1);
// Asserts that the array is truly sorted
assert.deepEqual(array.indexOf(firstObject), 0);
assert.deepEqual(array.indexOf(secondObject), 4);
assert.deepEqual(array.indexOf(thirdObject), 3);
assert.deepEqual(array.indexOf({key: 99}), -1);
});
});
4 changes: 2 additions & 2 deletions test/data_structures/hash_table.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ describe('Hash Table', function () {
'WGD)s;Zs<8K6(K_kVko"mV82Pcl)0Rx}jfq3VBm:MOX/gLfSPvLx~%(3jHh5gG2e' +
'JaQ|nW}ekR_W5Ldv`@j^hd%Wiw6moGekrS>k7gRR|dd?7Pi:`0; r_wq=-F-e(iY';
assert.equal(h.hash(longString), -998071508);
});
});

it('should initialize the table with the given capacity',
function () {
Expand All @@ -60,7 +60,7 @@ describe('Hash Table', function () {

h = new HashTable(2);
assert.equal(h.capacity, 2);
});
});

it('should allow putting and getting elements from the table', function () {
var h = new HashTable(16);
Expand Down

0 comments on commit 64de214

Please sign in to comment.