Skip to content
Permalink
Browse files

Lint fixes for exercises: complex-numbers, etl, gigasecond (#539)

* fix eslint errors for complex-numbers exercise

* fix eslint errors for etl exercise

* fix eslint errors and spelling for gigasecond exercise
  • Loading branch information...
trvrfrd authored and matthewmorgan committed Oct 30, 2018
1 parent 1853f06 commit a38f3a607cbeed656464a1cb91e6291d25dcf765
@@ -1,15 +1,12 @@
allergies
alphametics
clock
complex-numbers
connect
diamond
difference-of-squares
etl
flatten-array
food-chain
forth
gigasecond
grade-school
grains
hexadecimal
@@ -42,7 +42,7 @@ describe('Complex numbers', () => {

expect(actual).toEqual(expected);
});

xtest('Add purely real numbers', () => {
const expected = new ComplexNumber(3, 0);
const actual = new ComplexNumber(1, 0).add(new ComplexNumber(2, 0));
@@ -1,5 +1,4 @@
export default class ComplexNumber {

constructor(real, imag) {
this.real = real;
this.imag = imag;
@@ -16,15 +15,17 @@ export default class ComplexNumber {
mul(other) {
return new ComplexNumber(
(this.real * other.real) - (this.imag * other.imag),
(this.imag * other.real) + (this.real * other.imag));
(this.imag * other.real) + (this.real * other.imag),
);
}

div(other) {
return new ComplexNumber(
((this.real * other.real) + (this.imag * other.imag))
/ ((other.real * other.real) + (other.imag * other.imag)),
((this.imag * other.real) - (this.real * other.imag))
/ ((other.real * other.real) + (other.imag * other.imag)));
/ ((other.real * other.real) + (other.imag * other.imag)),
);
}

get abs() {
@@ -38,6 +39,7 @@ export default class ComplexNumber {
get exp() {
return new ComplexNumber(
Math.exp(this.real) * Math.cos(this.imag),
Math.exp(this.real) * Math.sin(this.imag));
Math.exp(this.real) * Math.sin(this.imag),
);
}
}
@@ -10,14 +10,18 @@ describe('Transform', () => {

xtest('transforms more values', () => {
const old = { 1: ['A', 'E', 'I', 'O', 'U'] };
const expected = { a: 1, e: 1, i: 1, o: 1, u: 1 };
const expected = {
a: 1, e: 1, i: 1, o: 1, u: 1,
};

expect(transform(old)).toEqual(expected);
});

xtest('transforms more keys', () => {
const old = { 1: ['A', 'E'], 2: ['D', 'G'] };
const expected = { a: 1, e: 1, d: 2, g: 2 };
const expected = {
a: 1, e: 1, d: 2, g: 2,
};

expect(transform(old)).toEqual(expected);
});
@@ -1,6 +1,6 @@
const GIGASECOND_IN_MILIS = 1e9 * 1e3;
const GIGASECOND_IN_MILLIS = 1e9 * 1e3;

export const gigasecond = dateOfBirth => {
export const gigasecond = (dateOfBirth) => {
const birthTime = dateOfBirth.getTime();
return new Date(birthTime + GIGASECOND_IN_MILIS);
}
return new Date(birthTime + GIGASECOND_IN_MILLIS);
};

0 comments on commit a38f3a6

Please sign in to comment.
You can’t perform that action at this time.