Upgrade dependencies and fix ESLint issues.

This commit is contained in:
Oleksii Trekhleb
2020-07-26 13:06:15 +02:00
parent 4d8baf87db
commit 63f5a27152
36 changed files with 4442 additions and 1630 deletions

View File

@@ -244,7 +244,7 @@ export default class FourierTester {
const { input, output: expectedOutput } = testCase;
// Try to split input signal into sequence of pure sinusoids.
const formattedInput = input.map(sample => sample.amplitude);
const formattedInput = input.map((sample) => sample.amplitude);
const currentOutput = fourierTransform(formattedInput);
// Check the signal has been split into proper amount of sub-signals.

View File

@@ -46,8 +46,8 @@ export default function fastFourierTransform(inputData, inverse = false) {
for (let blockLength = 2; blockLength <= N; blockLength *= 2) {
const imaginarySign = inverse ? -1 : 1;
const phaseStep = new ComplexNumber({
re: Math.cos(2 * Math.PI / blockLength),
im: imaginarySign * Math.sin(2 * Math.PI / blockLength),
re: Math.cos((2 * Math.PI) / blockLength),
im: imaginarySign * Math.sin((2 * Math.PI) / blockLength),
});
for (let blockStart = 0; blockStart < N; blockStart += blockLength) {

View File

@@ -9,7 +9,7 @@ export default function pascalTriangle(lineNumber) {
for (let numIndex = 1; numIndex < currentLineSize; numIndex += 1) {
// See explanation of this formula in README.
currentLine[numIndex] = currentLine[numIndex - 1] * (lineNumber - numIndex + 1) / numIndex;
currentLine[numIndex] = (currentLine[numIndex - 1] * (lineNumber - numIndex + 1)) / numIndex;
}
return currentLine;

View File

@@ -6,7 +6,7 @@ describe('degreeToRadian', () => {
expect(degreeToRadian(45)).toBe(Math.PI / 4);
expect(degreeToRadian(90)).toBe(Math.PI / 2);
expect(degreeToRadian(180)).toBe(Math.PI);
expect(degreeToRadian(270)).toBe(3 * Math.PI / 2);
expect(degreeToRadian(270)).toBe((3 * Math.PI) / 2);
expect(degreeToRadian(360)).toBe(2 * Math.PI);
});
});

View File

@@ -6,7 +6,7 @@ describe('radianToDegree', () => {
expect(radianToDegree(Math.PI / 4)).toBe(45);
expect(radianToDegree(Math.PI / 2)).toBe(90);
expect(radianToDegree(Math.PI)).toBe(180);
expect(radianToDegree(3 * Math.PI / 2)).toBe(270);
expect(radianToDegree((3 * Math.PI) / 2)).toBe(270);
expect(radianToDegree(2 * Math.PI)).toBe(360);
});
});