Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ build/Release

# Dependency directories
node_modules/
.env
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
Expand Down
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
dist
build
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"semi": true,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "es5",
"printWidth": 80
}
105 changes: 105 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "c55-core-week-6",
"version": "1.0.0",
"description": "The week 6 assignment for the HackYourFuture Core program can be found at the following link: https://hub.hackyourfuture.nl/core-program-week-6-assignment",
"homepage": "https://github.com/shmoonwalker/c55-core-week-6#readme",
"bugs": {
"url": "https://github.com/shmoonwalker/c55-core-week-6/issues"
},
"repository": {
"type": "git",
"url": "git+https://github.com/shmoonwalker/c55-core-week-6.git"
},
"license": "ISC",
"author": "",
"type": "module",
"main": "app.js",
"scripts": {
"start": "node app.js",
"format": "prettier --write \"**/*.js\""
},

"dependencies": {
"chalk": "^4.1.2"
},
"devDependencies": {
"prettier": "^3.8.1"
}
}
38 changes: 28 additions & 10 deletions reading-list-manager/app.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,31 @@
// This is the entrypoint for your application.
// node app.js

// TODO: Implement the main application logic here
// 1. Load books on startup
// 2. Display all books
// 3. Show summary statistics
// 4. Add example of filtering by genre or read/unread status
// 5. Add example of marking a book as read
import {
loadBooks,
addBook,
getUnreadBooks,
getBooksByGenre,
markAsRead,
printAllBooks,
printSummary,
} from './readingList.js';

console.log('📚 MY READING LIST 📚\n');

// Your implementation here
printAllBooks();

addBook({ title: 'The Alchemist', author: 'Paulo Coelho', genre: 'Fiction' });

printSummary();

console.log('\n🔍 Fiction Books:');
getBooksByGenre('Fiction').forEach((b) =>
console.log(` ${b.read ? '✓' : '⚠'} ${b.title} by ${b.author}`)
);

console.log('\n📌 Unread Books:');
getUnreadBooks().forEach((b) =>
console.log(` - ${b.title} by ${b.author} (id: ${b.id})`)
);

markAsRead(3);

printSummary();
45 changes: 44 additions & 1 deletion reading-list-manager/books.json
Original file line number Diff line number Diff line change
@@ -1 +1,44 @@
[]
[
{
"id": 1,
"title": "1984",
"author": "George Orwell",
"genre": "Fiction",
"read": false
},
{
"id": 2,
"title": "To Kill a Mockingbird",
"author": "Harper Lee",
"genre": "Fiction",
"read": true
},
{
"id": 3,
"title": "The Great Gatsby",
"author": "F. Scott Fitzgerald",
"genre": "Classic",
"read": true
},
{
"id": 4,
"title": "The Hobbit",
"author": "J.R.R. Tolkien",
"genre": "Fantasy",
"read": true
},
{
"id": 5,
"title": "Clean Code",
"author": "Robert C. Martin",
"genre": "Programming",
"read": false
},
{
"title": "The Alchemist",
"author": "Paulo Coelho",
"genre": "Fiction",
"id": 6,
"read": false
}
]
Loading