Skip to content

Commit 3dd450c

Browse files
authored
New: Updated structure and implementation for 2018-2019 updates (#41)
* Update: LinkedList to be ES6 and tested with Mocha/Chai * Update: LinkedList implementation * Update: Simplify LinkedList#values() * Update: LinkedList README * Chore: Fix JSDoc comment * Chore: Update comments * New: DoublyLinkedList implementation * Chore: Add ESLint * Remove: Old doubly linked list implementation * Update: README information * Chore: Add Travis CI
1 parent f25c750 commit 3dd450c

File tree

20 files changed

+3271
-1306
lines changed

20 files changed

+3271
-1306
lines changed

.eslintrc.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
module.exports = {
2+
"env": {
3+
"commonjs": true,
4+
"es6": true,
5+
"node": true
6+
},
7+
"extends": "eslint:recommended",
8+
"parserOptions": {
9+
"ecmaVersion": 2018
10+
},
11+
"rules": {
12+
"indent": [
13+
"error",
14+
4
15+
],
16+
"linebreak-style": [
17+
"error",
18+
"unix"
19+
],
20+
"quotes": [
21+
"error",
22+
"double"
23+
],
24+
"semi": [
25+
"error",
26+
"always"
27+
]
28+
}
29+
};

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
node_modules/
12
holding/

.travis.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
language: node_js
2+
node_js:
3+
- "8"
4+
- "9"
5+
- "10"
6+
- "11"
7+
sudo: false
8+
branches:
9+
only:
10+
- master
11+
12+
# Run npm test always
13+
script:
14+
- "npm test"

README.md

Lines changed: 60 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,84 @@
11
# Computer Science in JavaScript
22

3-
by [Nicholas C. Zakas](https://humanwhocodes.com) (Find this useful? Consider [donating](https://humanwhocodes.com/donate) to support my work.)
3+
by [Nicholas C. Zakas](https://humanwhocodes.com)
4+
5+
If you find this useful, please consider supporting my work with a [donation](https://humanwhocodes.com/donate).
46

57
## Description
68

79
Collection of classic computer science paradigms, algorithms, and approaches written in JavaScript. This is the source code for the series of blog posts on my website.
810

9-
### Data Structures
11+
## Folder Structure
1012

11-
Binary Search Tree
12-
https://humanwhocodes.com/blog/2009/06/09/computer-science-in-javascript-binary-search-tree-part-1/
13-
https://humanwhocodes.com/blog/2009/06/16/computer-science-in-javascript-binary-search-tree-part-2/
13+
The most recent packages are found in these directories:
1414

15-
Doubly Linked List
16-
https://humanwhocodes.com/blog/2009/04/21/computer-science-in-javascript-doubly-linked-lists/
15+
* `src` - the implementation source code
16+
* `tests`` - tests for the implementation source code
1717

18-
Linked List
19-
https://humanwhocodes.com/blog/2009/04/13/computer-science-in-javascript-linked-list/
18+
These directories contain **old** implementations that will be replaced eventually, they are just here to avoid confusing people who find this repo through the old blog posts:
2019

21-
### Sorting Algorithms
20+
* `data-structures` - data structure implementations that have not been updated yet
21+
* `encodings` - encoding implementations that have not been updated yet
22+
* `algorithms` - miscellanous algorithm implementations that have not been updated yet
2223

23-
Bubble Sort
24-
https://humanwhocodes.com/blog/2009/05/26/computer-science-in-javascript-bubble-sort/
24+
As I update these, implementations will move from these folders into `src`.
2525

26-
Selection Sort
27-
https://humanwhocodes.com/blog/2009/09/08/computer-science-in-javascript-selection-sort/
26+
## Branches
2827

29-
### Other Algorithms
28+
* **2009** - the branch containing all of the original implementations as reflected in my 2009 blog post series.
29+
* **master** - the branch where I'm updating the original implementations to use ECMAScript 2018 and later features.
30+
31+
## Installing
32+
33+
You must be using Node.js v8 or later.
34+
35+
First, clone the repo:
36+
37+
```
38+
$ git clone git://github.com/humanwhocodes/computer-science-in-javascript.git
39+
$ cd computer-science-in-javascript
40+
```
41+
42+
Then install the dependencies:
43+
44+
```
45+
$ npm install
46+
```
47+
48+
You can then run tests like this:
3049

31-
Base64 Encoding
32-
https://humanwhocodes.com/blog/2009/12/08/computer-science-in-javascript-base64-encoding/
50+
```
51+
$ npm test
52+
```
53+
54+
## Original Blog Posts
55+
56+
At some point I will update these blog posts for the new implementations. For now, they still refer only to the 2009 version of this code.
57+
58+
### Data Structures
59+
60+
* Binary Search Tree: [Part 1](https://humanwhocodes.com/blog/2009/06/09/computer-science-in-javascript-binary-search-tree-part-1/), [Part 2](https://humanwhocodes.com/blog/2009/06/16/computer-science-in-javascript-binary-search-tree-part-2/)
61+
* [Doubly Linked List](https://humanwhocodes.com/blog/2009/04/21/computer-science-in-javascript-doubly-linked-lists/)
62+
* [Linked List](https://humanwhocodes.com/blog/2009/04/13/computer-science-in-javascript-linked-list/)
63+
64+
### Sorting Algorithms
65+
66+
* [Bubble Sort](https://humanwhocodes.com/blog/2009/05/26/computer-science-in-javascript-bubble-sort/)
67+
* [Selection Sort](https://humanwhocodes.com/blog/2009/09/08/computer-science-in-javascript-selection-sort/)
68+
69+
### Other Algorithms
3370

34-
Binary Search
35-
https://humanwhocodes.com/blog/2009/09/01/computer-science-in-javascript-binary-search/
71+
* [Base64 Encoding](https://humanwhocodes.com/blog/2009/12/08/computer-science-in-javascript-base64-encoding/)
72+
* [Binary Search](https://humanwhocodes.com/blog/2009/09/01/computer-science-in-javascript-binary-search/)
73+
* [Credit Card Number Validation](https://humanwhocodes.com/blog/2009/08/04/computer-science-in-javascript-credit-card-number-validation/)
3674

37-
Credit Card Number Validation
38-
https://humanwhocodes.com/blog/2009/08/04/computer-science-in-javascript-credit-card-number-validation/
75+
## Note on Code Style
3976

77+
You may find the code style of this module to be overly verbose with a lot of comments. That is intentional, as the primary use of this module is intended to be for educational purposes. There are frequently more concise ways of implementing the details of this class, but the more concise ways are difficult for newcomers who are unfamiliar with linked lists as a concept or JavaScript as a whole.
4078

4179
## Issues and Pull Requests
4280

43-
Because this repository is based on a series of blog posts I wrote, I only accept issues and pull requests related to bugs.
81+
As this is part of series of tutorials I'm writing, only bug fixes will be accepted. No new functionality will be added to this module.
4482

4583
## License
4684

data-structures/doubly-linked-list/doubly-linked-list-tests.htm

Lines changed: 0 additions & 228 deletions
This file was deleted.

0 commit comments

Comments
 (0)