Skip to content

Commit cf8aa67

Browse files
cHaLkdusTmgechev
authored andcommitted
🚨 Fix linter errors
1 parent 213636f commit cf8aa67

File tree

4 files changed

+33
-33
lines changed

4 files changed

+33
-33
lines changed

src/others/fibonacci.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
* @param {Number} n The nth position in fibonacci's sequence
1515
*
1616
* @module others/fibonacci
17-
*/
17+
*/
1818
(function (exports) {
1919
'use strict';
2020

21-
function fibonacci (n) {
21+
function fibonacci(n) {
2222
if (n > 97) {
2323
throw 'Input too large, results in inaccurate fibonacci value.';
2424
}

src/others/fibonacciMemory.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@
1414
* @param {Number} n The nth position in fibonacciMemory's sequence
1515
*
1616
* @module others/fibonacciMemory
17-
*/
17+
*/
1818
(function (exports) {
19-
'use strict';
19+
'use strict';
2020

21-
function fibonacciMemory(n) {
22-
var i = 0;
23-
var aux = [0, 1];
24-
while (n != i) {
25-
aux[i + 2] = aux[i] + aux[i + 1];
26-
i++;
27-
}
28-
return aux[i];
21+
function fibonacciMemory(n) {
22+
var i = 0;
23+
var aux = [0, 1];
24+
while (n !== i) {
25+
aux[i + 2] = aux[i] + aux[i + 1];
26+
i += 1;
2927
}
28+
return aux[i];
29+
}
3030

31-
exports.fibonacciMemory = fibonacciMemory;
31+
exports.fibonacciMemory = fibonacciMemory;
3232
})(typeof window === 'undefined' ? module.exports : window);

src/searching/linearSearch.js

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

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

14-
const linearSearch = (array, key) => {
15-
for (let i = 0; i < array.length; i++) {
16-
if (array[i] == key) {
17-
return i;
18-
}
19-
}
20-
return -1;
14+
const linearSearch = (array, key) => {
15+
for (let i = 0; i < array.length; i += 1) {
16+
if (array[i] === key) {
17+
return i;
18+
}
2119
}
20+
return -1;
21+
};
2222

23-
exports.linearSearch = linearSearch;
24-
})(typeof window === 'undefined' ? module.exports : window);
23+
exports.linearSearch = linearSearch;
24+
})(typeof window === 'undefined' ? module.exports : window);

test/others/fibonacciMemory.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ describe('fibonacci with Memory algorithm', function () {
2121
});
2222
it('should return value 10 with input 55.', function () {
2323
expect(fibonacci(10)).toBe(55);
24-
});
24+
});
2525
it('should be 135301852344706760000 with input 98.', function () {
2626
expect(fibonacci(98)).toBe(135301852344706760000);
2727
});

0 commit comments

Comments
 (0)