Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/andrewjh271/library
https://github.com/andrewjh271/library
Last synced: 16 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/andrewjh271/library
- Owner: andrewjh271
- Created: 2021-03-02T05:01:06.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-08-08T23:12:26.000Z (5 months ago)
- Last Synced: 2024-12-09T09:54:14.267Z (27 days ago)
- Language: JavaScript
- Size: 18.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Library App
Simple Javascript Library app, created as part of the Odin Project [curriculum](https://www.theodinproject.com/courses/javascript/lessons/library). View [live page](https://andrewjh271.github.io/library/).
Books can be sorted by any of the headings. Data is persisted using `localStorage`.
###### Thoughts
I originally did not have `toggleRead()` as a function of`Book`, so line 89 changed from the first line to the second:
```javascript
library[index].read = !library[index].read;
``````javascript
library[index].toggleRead();
```I liked that the latter is more modular and readable, but it initially caused problems when recreating `library[]` using `JSON.parse` and `localStorage`, which cannot create custom objects. This was resolved with the line:
```javascript
library = JSON.parse(storedLibrary).map((book) => new Book(book));
```