Skip to content

Commit 7a4d3ab

Browse files
chore: migrate to yarn and upgrade devDependencies
1 parent 956aa11 commit 7a4d3ab

9 files changed

+4598
-5564
lines changed

Diff for: package-lock.json

-5,523
This file was deleted.

Diff for: package.json

+10-10
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
},
2222
"main": "src/index.js",
2323
"scripts": {
24-
"lint": "npx prettier -l src/**/*.js && eslint src/**",
25-
"prettify": "npx prettier --write src/**/*.js",
24+
"lint": "prettier -l src/**/*.js && eslint src/**",
25+
"prettify": "prettier --write src/**/*.js",
2626
"test": "jest --verbose --coverage",
2727
"coverage": "jest --collectCoverageFrom=src/**.js --coverage"
2828
},
@@ -32,15 +32,15 @@
3232
}
3333
},
3434
"devDependencies": {
35-
"eslint": "^5.9.0",
36-
"eslint-config-airbnb": "^17.1.0",
37-
"eslint-config-airbnb-base": "^13.1.0",
38-
"eslint-config-prettier": "^3.3.0",
35+
"eslint": "^7.11.0",
36+
"eslint-config-airbnb": "^18.2.0",
37+
"eslint-config-airbnb-base": "^14.2.0",
38+
"eslint-config-prettier": "^6.13.0",
3939
"eslint-plugin-import": "^2.14.0",
40-
"eslint-plugin-jest": "^22.1.2",
40+
"eslint-plugin-jest": "^24.1.0",
4141
"eslint-plugin-prettier": "^3.0.0",
42-
"husky": "^1.3.1",
43-
"jest": "^24.5.0",
44-
"prettier": "1.15.3"
42+
"husky": "^4.3.0",
43+
"jest": "^26.5.3",
44+
"prettier": "2.1.2"
4545
}
4646
}

Diff for: src/index.spec.js

+10-10
Original file line numberDiff line numberDiff line change
@@ -48,22 +48,22 @@ describe('NWaligner instance align() method', () => {
4848
expect(alignment).toHaveProperty('scoringMatrix');
4949
expect(alignment.scoringMatrix).toEqual(expect.any(Array));
5050
expect(alignment.scoringMatrix).toHaveLength(seq1.length + 1);
51-
alignment.scoringMatrix.forEach(row => {
51+
alignment.scoringMatrix.forEach((row) => {
5252
expect(row).toHaveLength(seq2.length + 1);
53-
row.forEach(cell => expect(cell).toEqual(expect.any(Number)));
53+
row.forEach((cell) => expect(cell).toEqual(expect.any(Number)));
5454
});
5555

5656
expect(alignment).toHaveProperty('tracebackMatrix');
5757
expect(alignment.tracebackMatrix).toEqual(expect.any(Array));
5858
expect(alignment.tracebackMatrix).toHaveLength(seq1.length + 1);
59-
alignment.tracebackMatrix.forEach(row => {
59+
alignment.tracebackMatrix.forEach((row) => {
6060
expect(row).toHaveLength(seq2.length + 1);
61-
row.forEach(cell => expect(cell).toEqual(expect.anything()));
61+
row.forEach((cell) => expect(cell).toEqual(expect.anything()));
6262
});
6363

6464
expect(alignment).toHaveProperty('coordinateWalk');
6565
expect(alignment.coordinateWalk).toEqual(expect.any(Array));
66-
alignment.coordinateWalk.forEach(coordinate => {
66+
alignment.coordinateWalk.forEach((coordinate) => {
6767
expect(coordinate).toEqual([expect.any(Number), expect.any(Number)]);
6868
});
6969

@@ -121,22 +121,22 @@ describe('SWaligner instance align() method', () => {
121121
expect(alignment).toHaveProperty('scoringMatrix');
122122
expect(alignment.scoringMatrix).toEqual(expect.any(Array));
123123
expect(alignment.scoringMatrix).toHaveLength(seq1.length + 1);
124-
alignment.scoringMatrix.forEach(row => {
124+
alignment.scoringMatrix.forEach((row) => {
125125
expect(row).toHaveLength(seq2.length + 1);
126-
row.forEach(cell => expect(cell).toEqual(expect.any(Number)));
126+
row.forEach((cell) => expect(cell).toEqual(expect.any(Number)));
127127
});
128128

129129
expect(alignment).toHaveProperty('tracebackMatrix');
130130
expect(alignment.tracebackMatrix).toEqual(expect.any(Array));
131131
expect(alignment.tracebackMatrix).toHaveLength(seq1.length + 1);
132-
alignment.tracebackMatrix.forEach(row => {
132+
alignment.tracebackMatrix.forEach((row) => {
133133
expect(row).toHaveLength(seq2.length + 1);
134-
row.forEach(cell => expect(cell).toEqual(expect.anything()));
134+
row.forEach((cell) => expect(cell).toEqual(expect.anything()));
135135
});
136136

137137
expect(alignment).toHaveProperty('coordinateWalk');
138138
expect(alignment.coordinateWalk).toEqual(expect.any(Array));
139-
alignment.coordinateWalk.forEach(coordinate => {
139+
alignment.coordinateWalk.forEach((coordinate) => {
140140
expect(coordinate).toEqual([expect.any(Number), expect.any(Number)]);
141141
});
142142

Diff for: src/matrix.utils.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const extractRow = ({ matrix, row, col }) => matrix[row].slice(0, col + 1);
5050
const extractColumn = ({ matrix, row, col }) =>
5151
matrix
5252
.slice(0, row + 1)
53-
.map(_row => _row.slice(col, col + 1))
53+
.map((_row) => _row.slice(col, col + 1))
5454
.reduce((prev, curr) => [...prev, ...curr], []);
5555

5656
module.exports = {

Diff for: src/matrix.utils.spec.js

+30-4
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,21 @@ describe('Matrix creation', () => {
3333
[0, 0, 0],
3434
],
3535
],
36-
[{ width: 3, heigth: 3 }, [[0, 0, 0], [0, 0, 0], [0, 0, 0]]],
37-
[{ width: 2, heigth: 2 }, [[0, 0], [0, 0]]],
36+
[
37+
{ width: 3, heigth: 3 },
38+
[
39+
[0, 0, 0],
40+
[0, 0, 0],
41+
[0, 0, 0],
42+
],
43+
],
44+
[
45+
{ width: 2, heigth: 2 },
46+
[
47+
[0, 0],
48+
[0, 0],
49+
],
50+
],
3851
[{ width: 1, heigth: 1 }, [[0]]],
3952
[{ width: 0, heigth: 0 }, []],
4053
])('should return a matrix with the specified dimensions', (input, output) =>
@@ -67,8 +80,21 @@ describe('Initial matrix creation for Needleman-Wunsch', () => {
6780
[-9, 0, 0],
6881
],
6982
],
70-
[{ width: 3, heigth: 3 }, [[0, -1, -2], [-1, 0, 0], [-2, 0, 0]]],
71-
[{ width: 2, heigth: 2 }, [[0, -1], [-1, 0]]],
83+
[
84+
{ width: 3, heigth: 3 },
85+
[
86+
[0, -1, -2],
87+
[-1, 0, 0],
88+
[-2, 0, 0],
89+
],
90+
],
91+
[
92+
{ width: 2, heigth: 2 },
93+
[
94+
[0, -1],
95+
[-1, 0],
96+
],
97+
],
7298
[{ width: 1, heigth: 1 }, [[0]]],
7399
[{ width: 0, heigth: 0 }, []],
74100
])(

Diff for: src/traceback.utils.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const { directions } = require('./dtypes');
22

3-
const alignmentUpdaters = gapSymbol => direction => {
3+
const alignmentUpdaters = (gapSymbol) => (direction) => {
44
const updaters = {
55
[directions.DIAGONAL]: ({ seq1, seq2, row, col }) => [seq1[row - 1], seq2[col - 1]],
66
[directions.LEFT]: ({ seq2, col }) => [gapSymbol, seq2[col - 1]],
@@ -9,7 +9,7 @@ const alignmentUpdaters = gapSymbol => direction => {
99
return updaters[direction];
1010
};
1111

12-
const coordinateUpdaters = direction => {
12+
const coordinateUpdaters = (direction) => {
1313
const getters = {
1414
[directions.DIAGONAL]: ([row, col]) => [row - 1, col - 1],
1515
[directions.LEFT]: ([row, col]) => [row, col - 1],

Diff for: src/utils.js

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
const { TracedScore } = require('./dtypes');
22

3-
const pipe = (...fns) => fns.reduce((prev, curr) => x => curr(prev(x)), x => x);
3+
const pipe = (...fns) =>
4+
fns.reduce(
5+
(prev, curr) => (x) => curr(prev(x)),
6+
(x) => x,
7+
);
48

5-
const reverse = x => -x;
9+
const reverse = (x) => -x;
610

711
const nanException = () => {
812
throw TypeError('Non number input to decreaseAndRectify().');
913
};
1014

11-
const throwIfNotNumber = x => (Number.isNaN(Number(x)) ? nanException() : x);
15+
const throwIfNotNumber = (x) => (Number.isNaN(Number(x)) ? nanException() : x);
1216

1317
const scoreReducer = (max, score) => {
1418
if (Number.isInteger(score.score)) {
@@ -21,9 +25,6 @@ const reduceTracedScores = (scores, defaultScore) =>
2125
scores.reduce(scoreReducer, TracedScore(defaultScore));
2226

2327
module.exports = {
24-
reverse: pipe(
25-
throwIfNotNumber,
26-
reverse,
27-
),
28+
reverse: pipe(throwIfNotNumber, reverse),
2829
reduceTracedScores,
2930
};

Diff for: src/utils.spec.js

+13-7
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,19 @@ const { reverse, reduceTracedScores } = require('./utils');
22
const { TracedScore } = require('./dtypes');
33

44
describe('Reverse', () => {
5-
it.each([0, -1, 2, -3, 54, -156, -89689, 0.34])(
6-
'should reverse the sign of every numeric input',
7-
n => expect(reverse(n)).toBe(-1 * n),
8-
);
5+
it.each([
6+
0,
7+
-1,
8+
2,
9+
-3,
10+
54,
11+
-156,
12+
-89689,
13+
0.34,
14+
])('should reverse the sign of every numeric input', (n) => expect(reverse(n)).toBe(-1 * n));
915
it.each(['string', [1, 2, 3], { a: 1, b: 2 }])(
1016
'should raise TypeError for non number inputs',
11-
n => expect(() => reverse(n)).toThrowError(TypeError),
17+
(n) => expect(() => reverse(n)).toThrowError(TypeError),
1218
);
1319
});
1420

@@ -25,14 +31,14 @@ describe('TracedScore reducer', () => {
2531
[[TracedScore(1), TracedScore(-3), TracedScore('4')]],
2632
[[TracedScore(3), TracedScore(() => {}), TracedScore(13)]],
2733
[[{ novalue: 3 }]],
28-
])('should throw TypeError if supplied with non integer score values', toReduce =>
34+
])('should throw TypeError if supplied with non integer score values', (toReduce) =>
2935
expect(() => reduceTracedScores(toReduce)).toThrowError(TypeError),
3036
);
3137
it.each([
3238
[[TracedScore(-1), TracedScore(-4), TracedScore(-18)]],
3339
[[TracedScore(0), TracedScore(0), TracedScore(0)]],
3440
[[]],
35-
])('should default to and object with default score and direction NONE', toReduce =>
41+
])('should default to and object with default score and direction NONE', (toReduce) =>
3642
expect(reduceTracedScores(toReduce, 0)).toEqual(TracedScore(0)),
3743
);
3844
it('should throw TypeError if objects with no value property are supplied', () =>

0 commit comments

Comments
 (0)