Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f918b0d

Browse files
author
programmiri
committed
Add exercise meetup
1 parent 9f548e1 commit f918b0d

File tree

6 files changed

+4383
-0
lines changed

6 files changed

+4383
-0
lines changed

‎meetup/.eslintrc‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"root": true,
3+
"parser": "babel-eslint",
4+
"parserOptions": {
5+
"ecmaVersion": 7,
6+
"sourceType": "module"
7+
},
8+
"env": {
9+
"es6": true,
10+
"node": true,
11+
"jest": true
12+
},
13+
"extends": [
14+
"eslint:recommended",
15+
"plugin:import/errors",
16+
"plugin:import/warnings"
17+
],
18+
"rules": {
19+
"linebreak-style": "off",
20+
21+
"import/extensions": "off",
22+
"import/no-default-export": "off",
23+
"import/no-unresolved": "off",
24+
"import/prefer-default-export": "off"
25+
}
26+
}

‎meetup/README.md‎

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Meetup
2+
3+
Calculate the date of meetups.
4+
5+
Typically meetups happen on the same day of the week. In this exercise, you
6+
will take a description of a meetup date, and return the actual meetup date.
7+
8+
Examples of general descriptions are:
9+
10+
- The first Monday of January 2017
11+
- The third Tuesday of January 2017
12+
- The wednesteenth of January 2017
13+
- The last Thursday of January 2017
14+
15+
The descriptors you are expected to parse are:
16+
first, second, third, fourth, fifth, last, monteenth, tuesteenth, wednesteenth,
17+
thursteenth, friteenth, saturteenth, sunteenth
18+
19+
Note that "monteenth", "tuesteenth", etc are all made up words. There was a
20+
meetup whose members realized that there are exactly 7 numbered days in a month
21+
that end in '-teenth'. Therefore, one is guaranteed that each day of the week
22+
(Monday, Tuesday, ...) will have exactly one date that is named with '-teenth'
23+
in every month.
24+
25+
Given examples of a meetup dates, each containing a month, day, year, and
26+
descriptor calculate the date of the actual meetup. For example, if given
27+
"The first Monday of January 2017", the correct meetup date is 2017年1月2日.
28+
29+
## Setup
30+
31+
Go through the setup instructions for Javascript to install the necessary
32+
dependencies:
33+
34+
[https://exercism.io/tracks/javascript/installation](https://exercism.io/tracks/javascript/installation)
35+
36+
## Requirements
37+
38+
Install assignment dependencies:
39+
40+
```bash
41+
$ npm install
42+
```
43+
44+
## Making the test suite pass
45+
46+
Execute the tests with:
47+
48+
```bash
49+
$ npm test
50+
```
51+
52+
In the test suites all tests but the first have been skipped.
53+
54+
Once you get a test passing, you can enable the next one by changing `xtest` to
55+
`test`.
56+
57+
## Source
58+
59+
Jeremy Hinegardner mentioned a Boulder meetup that happens on the Wednesteenth of every month [https://twitter.com/copiousfreetime](https://twitter.com/copiousfreetime)
60+
61+
## Submitting Incomplete Solutions
62+
63+
It's possible to submit an incomplete solution so you can see how others have
64+
completed the exercise.

‎meetup/babel.config.js‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module.exports = {
2+
presets: [
3+
[
4+
'@babel/env',
5+
{
6+
targets: {
7+
node: 'current',
8+
},
9+
useBuiltIns: false,
10+
},
11+
12+
],
13+
],
14+
};

‎meetup/meetup.spec.js‎

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import { meetupDay } from './meetup';
2+
3+
describe('meetupDay()', () => {
4+
test('test monteenth of may 2013', () => {
5+
expect(meetupDay(2013, 4, 'Monday', 'teenth')).toEqual(new Date(2013, 4, 13));
6+
});
7+
8+
xtest('test saturteenth of february 2013', () => {
9+
expect(meetupDay(2013, 1, 'Saturday', 'teenth')).toEqual(new Date(2013, 1, 16));
10+
});
11+
12+
xtest('test first tuesday of may 2013', () => {
13+
expect(meetupDay(2013, 4, 'Tuesday', '1st')).toEqual(new Date(2013, 4, 7));
14+
});
15+
16+
xtest('test second monday of april 2013', () => {
17+
expect(meetupDay(2013, 3, 'Monday', '2nd')).toEqual(new Date(2013, 3, 8));
18+
});
19+
20+
xtest('test third thursday of september 2013', () => {
21+
expect(meetupDay(2013, 8, 'Thursday', '3rd')).toEqual(new Date(2013, 8, 19));
22+
});
23+
24+
xtest('test fourth sunday of march 2013', () => {
25+
expect(meetupDay(2013, 2, 'Sunday', '4th')).toEqual(new Date(2013, 2, 24));
26+
});
27+
28+
xtest('test last thursday of october 2013', () => {
29+
expect(meetupDay(2013, 9, 'Thursday', 'last')).toEqual(new Date(2013, 9, 31));
30+
});
31+
32+
xtest('test last wednesday of february 2012', () => {
33+
expect(meetupDay(2012, 1, 'Wednesday', 'last')).toEqual(new Date(2012, 1, 29));
34+
});
35+
36+
xtest('test last wednesday of december 2014', () => {
37+
expect(meetupDay(2014, 11, 'Wednesday', 'last')).toEqual(new Date(2014, 11, 31));
38+
});
39+
40+
xtest('test last sunday of only four week february 2015', () => {
41+
expect(meetupDay(2015, 1, 'Sunday', 'last')).toEqual(new Date(2015, 1, 22));
42+
});
43+
44+
xtest('test first friday of december 2012', () => {
45+
expect(meetupDay(2012, 11, 'Friday', '1st')).toEqual(new Date(2012, 11, 7));
46+
});
47+
48+
xtest('test fifth monday of march 2015', () => {
49+
expect(meetupDay(2015, 2, 'Monday', '5th')).toEqual(new Date(2015, 2, 30));
50+
});
51+
52+
xtest('test nonexistent fifth monday of february 2015', () => {
53+
expect(() => {
54+
meetupDay(2015, 1, 'Monday', '5th');
55+
}).toThrow();
56+
});
57+
});

‎meetup/package.json‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"name": "exercism-javascript",
3+
"version": "0.0.0",
4+
"description": "Exercism exercises in Javascript.",
5+
"author": "Katrina Owen",
6+
"private": true,
7+
"repository": {
8+
"type": "git",
9+
"url": "https://github.com/exercism/javascript"
10+
},
11+
"devDependencies": {
12+
"@babel/cli": "^7.2.3",
13+
"@babel/core": "^7.4.0",
14+
"@babel/preset-env": "^7.4.2",
15+
"babel-eslint": "^10.0.1",
16+
"babel-jest": "^24.5.0",
17+
"eslint": "^5.15.3",
18+
"eslint-plugin-import": "^2.16.0",
19+
"jest": "^24.5.0"
20+
},
21+
"jest": {
22+
"modulePathIgnorePatterns": [
23+
"package.json"
24+
]
25+
},
26+
"scripts": {
27+
"test": "jest --no-cache ./*",
28+
"watch": "jest --no-cache --watch ./*",
29+
"lint": "eslint .",
30+
"lint-test": "eslint . && jest --no-cache ./* "
31+
},
32+
"license": "MIT",
33+
"dependencies": {}
34+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /