Skip to content

Fixed linting errors for failing build #200

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/others/fibonacciMemory.js
Original file line number Diff line number Diff line change
@@ -16,17 +16,17 @@
* @module others/fibonacciMemory
*/
(function (exports) {
'use strict';
'use strict';

function fibonacciMemory(n) {
var i = 0;
var aux = [0, 1];
while (n != i) {
aux[i + 2] = aux[i] + aux[i + 1];
i++;
}
return aux[i];
function fibonacciMemory(n) {
var i = 0;
var aux = [0, 1];
while (n !== i) {
aux[i + 2] = aux[i] + aux[i + 1];
i += 1;
}
return aux[i];
}

exports.fibonacciMemory = fibonacciMemory;
exports.fibonacciMemory = fibonacciMemory;
})(typeof window === 'undefined' ? module.exports : window);
22 changes: 11 additions & 11 deletions src/searching/linearSearch.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
(function (exports) {
'use strict';
'use strict';

/**
* Searches for specific element in a given array
* using the linear search algorithm
* Time complexity: O(n)
*
*
* @param {Array} array Input array
* @param {Number} key the number whose index is to be found
* @returns {Number} the index of the first instance of number or else -1 if not found
*/

const linearSearch = (array, key) => {
for (let i = 0; i < array.length; i++) {
if (array[i] == key) {
return i;
}
}
return -1;
const linearSearch = (array, key) => {
for (let i = 0; i < array.length; i += 1) {
if (array[i] === key) {
return i;
}
}
return -1;
}

exports.linearSearch = linearSearch;
})(typeof window === 'undefined' ? module.exports : window);
exports.linearSearch = linearSearch;
})(typeof window === 'undefined' ? module.exports : window);
2 changes: 1 addition & 1 deletion test/others/fibonacciMemory.spec.js
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ describe('fibonacci with Memory algorithm', function () {
});
it('should return value 10 with input 55.', function () {
expect(fibonacci(10)).toBe(55);
});
});
it('should be 135301852344706760000 with input 98.', function () {
expect(fibonacci(98)).toBe(135301852344706760000);
});