Skip to content

Commit 2f63b3e

Browse files
author
Michael Frank
committed
added trailing semicolon to all function and module exports
1 parent 58d2eb1 commit 2f63b3e

File tree

30 files changed

+2096
-7340
lines changed

30 files changed

+2096
-7340
lines changed

.eslintrc.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"extends": "airbnb-base",
3+
"plugins": [
4+
"import"
5+
],
6+
"parserOptions": {
7+
"ecmaVersion": 12,
8+
"sourceType": "module"
9+
},
10+
"rules": {
11+
}
12+
}

caesar/README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Exercise XX - caesar cipher
1+
# Exercise XX - Caesar cipher
22

3-
Implement the legendary caesar cipher:
3+
Implement the legendary Caesar cipher:
44

55
> In cryptography, a Caesar cipher, also known as Caesar's cipher, the shift cipher, Caesar's code or Caesar shift, is one of the simplest and most widely known encryption techniques. It is a type of substitution cipher in which each letter in the plaintext is replaced by a letter some fixed number of positions down the alphabet. For example, with a left shift of 3, D would be replaced by A, E would become B, and so on. The method is named after Julius Caesar, who used it in his private correspondence.
66
@@ -31,5 +31,3 @@ negative numbers should work as well:
3131
```javascript
3232
caesar('Mjqqt, Btwqi!', -5) // returns 'Hello, World!'
3333
```
34-
35-

caesar/caesar.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const caesar = function() {
22

3-
}
3+
};;
44

5-
module.exports = caesar
5+
module.exports = caesar;

calculator/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ The goal for this exercise is to create a calculator that does the following:
22

33
add, subtract, get the sum, multiply, get the power, and find the factorial
44

5-
In order to do this please fill out each function with your solution. Make sure to return the value so you can test it in Jasmine! To see the expected value
6-
take a look at the spec file that houses the Jasmine test cases.
5+
In order to do this please fill out each function with your solution. Make sure to return the value so you can test it in Jest! To see the expected value
6+
take a look at the spec file that houses the Jest test cases.

calculator/calculator.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
const add = function() {
22

3-
}
3+
};
44

55
const subtract = function() {
66

7-
}
7+
};
88

99
const sum = function() {
1010

11-
}
11+
};
1212

1313
const multiply = function() {
1414

15-
}
15+
};;
1616

1717
const power = function() {
1818

19-
}
19+
};
2020

2121
const factorial = function() {
2222

23-
}
23+
};
2424

2525
module.exports = {
2626
add,
@@ -29,4 +29,4 @@ module.exports = {
2929
multiply,
3030
power,
3131
factorial
32-
}
32+
};

calculator/calculator.spec.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,55 @@
1-
const calculator = require ('./calculator.js');
1+
const calculator = require('./calculator');
22

33
describe('add', () => {
44
test('adds 0 and 0', () => {
55
expect(calculator.add(0,0)).toBe(0);
66
});
77

8-
test('adds 2 and 2', () => {
8+
test.skip('adds 2 and 2', () => {
99
expect(calculator.add(2,2)).toBe(4);
1010
});
1111

12-
test('adds positive numbers', () => {
12+
test.skip('adds positive numbers', () => {
1313
expect(calculator.add(2,6)).toBe(8);
1414
});
1515
});
1616

1717
describe('subtract', () => {
18-
test('subtracts numbers', () => {
18+
test.skip('subtracts numbers', () => {
1919
expect(calculator.subtract(10,4)).toBe(6);
2020
});
2121
});
2222

2323
describe('sum', () => {
24-
test('computes the sum of an empty array', () => {
24+
test.skip('computes the sum of an empty array', () => {
2525
expect(calculator.sum([])).toBe(0);
2626
});
2727

28-
test('computes the sum of an array of one number', () => {
28+
test.skip('computes the sum of an array of one number', () => {
2929
expect(calculator.sum([7])).toBe(7);
3030
});
3131

32-
test('computes the sum of an array of two numbers', () => {
32+
test.skip('computes the sum of an array of two numbers', () => {
3333
expect(calculator.sum([7,11])).toBe(18);
3434
});
3535

36-
test('computes the sum of an array of many numbers', () => {
36+
test.skip('computes the sum of an array of many numbers', () => {
3737
expect(calculator.sum([1,3,5,7,9])).toBe(25);
3838
});
3939
});
4040

4141
describe('multiply', () => {
42-
test('multiplies two numbers', () => {
42+
test.skip('multiplies two numbers', () => {
4343
expect(calculator.multiply([2,4])).toBe(8);
4444
});
4545

46-
test('multiplies several numbers', () => {
46+
test.skip('multiplies several numbers', () => {
4747
expect(calculator.multiply([2,4,6,8,10,12,14])).toBe(645120);
4848
});
4949
});
5050

5151
describe('power', () => {
52-
test('raises one number to the power of another number', () => {
52+
test.skip('raises one number to the power of another number', () => {
5353
expect(calculator.power(4,3)).toBe(64); // 4 to third power is 64
5454
});
5555
});

fibonacci/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# Exercise XX - fibonacci
1+
# Exercise XX - Fibonacci
22

3-
Create a function that returns a specific member of the fibonacci sequence:
3+
Create a function that returns a specific member of the Fibonacci sequence:
44

5-
> a series of numbers in which each number ( Fibonacci number ) is the sum of the two preceding numbers. The simplest is the series 1, 1, 2, 3, 5, 8, etc.
5+
> A series of numbers in which each number ( Fibonacci number ) is the sum of the two preceding numbers. The simplest is the series 1, 1, 2, 3, 5, 8, etc.
66
77
```javascript
88
fibonacci(4) // returns the 4th member of the series: 3 (1, 1, 2, 3)

fibonacci/fibonacci.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const fibonacci = function() {
22

3-
}
3+
};
44

55
module.exports = fibonacci;

findTheOldest/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
# Find the Oldest
22

3-
given an array of objects representing people with a birth and death year, return the oldest person.
3+
Given an array of objects representing people with a birth and death year, return the oldest person.
44

55
## Hints
66
- You should return the whole person object, but the tests mostly just check to make sure the name is correct.
77
- this can be done with a couple of chained array methods, or by using `reduce`.
88
- One of the tests checks for people with no death-date.. use JavaScript's Date function to get their age as of today.
9-

findTheOldest/findTheOldest.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const findTheOldest = function() {
22

3-
}
3+
};
44

5-
module.exports = findTheOldest
5+
module.exports = findTheOldest;
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
let <%= title %> = function() {
22

3-
}
3+
};
44

5-
module.exports = <%= title %>
5+
module.exports = <%= title %>;

getTheTitles/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const books = [
1515
]
1616
```
1717

18-
your job is to write a function that takes the array and returns an array of titles:
18+
Your job is to write a function that takes the array and returns an array of titles:
1919

2020
```javascript
2121
getTheTitles(books) // ['Book','Book2']

getTheTitles/getTheTitles.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const getTheTitles = function() {
22

3-
}
3+
};
44

55
module.exports = getTheTitles;

getTheTitles/getTheTitles.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ describe('getTheTitles', () => {
1313
]
1414

1515
test('gets titles', () => {
16-
expect(getTheTitles(books)).toBe(['Book','Book2']);
16+
expect(getTheTitles(books)).toEqual(['Book','Book2']);
1717
});
1818

1919
});

helloWorld/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ In this directory you will find 2 other files:
66
1. `helloWorld.js`
77
2. `helloWorld.spec.js`
88

9-
This setup should be the same for all of the exercises. The plain javascript file is where you'll write your code, and the `spec` file contains the tests that verify your code is functional.
9+
This setup should be the same for all of the exercises. The plain javascript file is where you'll write your code, and the `spec` file contains the tests that verify your code is functional.
1010

1111
Let's look at the spec file first:
1212
```javascript
@@ -20,31 +20,31 @@ describe('Hello World', function() {
2020
```
2121
At the very top of the file we use `require()` to import the code from the javascript file (`helloWorld.js`) so that we can test it.
2222

23-
The next block (`describe()`) is the body of the test. Basically, all it's doing is running your code and testing to see if the output is correct. The `test()` function describes what should be happening in plain english and then includes the `expect()` function. For this simple example it should be pretty simple to read.
23+
The next block (`describe()`) is the body of the test. Basically, all it's doing is running your code and testing to see if the output is correct. The `test()` function describes what should be happening in plain english and then includes the `expect()` function. For this simple example it should be pretty simple to read.
2424

25-
For now you do not need to worry about how to write tests, but you should try to get comfortable enough with the syntax to figure out what the tests are asking you to do. Go ahead and run the tests by entering `jasmine helloWorld.spec.js` in the terminal and watch it fail. The output from that command should tell you exactly what went wrong with your code. In this case, running the `helloWorld()` function should return the phrase 'Hello, World!' but instead it returns an empty string...
25+
For now you do not need to worry about how to write tests, but you should try to get comfortable enough with the syntax to figure out what the tests are asking you to do. Go ahead and run the tests by entering `npm test helloWorld.spec.js` in the terminal and watch it fail. The output from that command should tell you exactly what went wrong with your code. In this case, running the `helloWorld()` function should return the phrase 'Hello, World!' but instead it returns an empty string...
2626

2727
so let's look at the javascript file:
2828
```javascript
2929
const helloWorld = function() {
3030
return ''
3131
}
3232

33-
module.exports = helloWorld;
33+
module.exports = helloWorld
3434
```
35-
In this file we have a simple function called helloWorld that returns an empty string... which is exactly what our test was complaining about. The `module.exports` on the last line is how we export the function so that it can be imported with `require()` in the spec file.
35+
In this file we have a simple function called helloWorld that returns an empty string... which is exactly what our test was complaining about. The `module.exports` on the last line is how we export the function so that it can be imported with `require()` in the spec file.
3636

3737
Go ahead and see if you can make the test pass by editing the return value of the function, and then running the test file again.
3838

39-
Just to make sure, in case you're confused at this point, the test is telling you that running the function `helloWorld` should return the phrase `Hello, World!`. Punctuation and capitalization definitely matter here, so double check that if the test still isn't passing.
39+
Just to make sure, in case you're confused at this point, the test is telling you that running the function `helloWorld` should return the phrase `Hello, World!`. Punctuation and capitalization definitely matter here, so double check that if the test still isn't passing.
4040

4141
this is what the final function should look like:
4242
```javascript
4343
const helloWorld = function() {
4444
return 'Hello, World!'
4545
}
4646

47-
module.exports = helloWorld;
47+
module.exports = helloWorld
4848
```
4949

50-
For the most part we've set up these tests in such a way that you only have to write the code being tested. You should not have to worry about importing or exporting anything at this stage, so just work around that bit of the code and write what it takes to make them pass!
50+
For the most part we've set up these tests in such a way that you only have to write the code being tested. You should not have to worry about importing or exporting anything at this stage.. so just work around that bit of the code and write what it takes to make them pass!

leapYears/leapYears.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const leapYears = function() {
22

3-
}
3+
};
44

5-
module.exports = leapYears
5+
module.exports = leapYears;

0 commit comments

Comments
 (0)