Open Israel-Laguan opened 4 years ago
Great job! Especially with the Firebase!
https://github.com/mohamednaser/library/blob/4b67e36a4aaa29e542929be7a57cf54fd5ce4c44/JS/firebase.js#L59-L70 https://github.com/mohamednaser/library/blob/4b67e36a4aaa29e542929be7a57cf54fd5ce4c44/index.html#L153-L167
It's a good idea to validate all the inputs on the method createBook() It can prevent people from leaving fields blank, from entering too little or too much or from using invalid characters.
You can check this article for more info: JavaScript: Form Validation
Maybe name the folder using lowercase, i. e. src/js/
As you have only one file, it's weird if you put firebase
as a name. Maybe main.js
or even index.js
sounds nice in this case.
The name of the class sounds like you have a fork of firebase. What about firebaseConnection
or firebaseAPI
?
https://github.com/mohamednaser/library/blob/4b67e36a4aaa29e542929be7a57cf54fd5ce4c44/JS/firebase.js#L1
This variable is used? Maybe it is not necessary? https://github.com/mohamednaser/library/blob/4b67e36a4aaa29e542929be7a57cf54fd5ce4c44/JS/firebase.js#L19
Consider using string literals instead of defining line by line, a reference here. https://github.com/mohamednaser/library/blob/4b67e36a4aaa29e542929be7a57cf54fd5ce4c44/JS/firebase.js#L29-L52
What about using camelCase naming for keys in this object? https://github.com/mohamednaser/library/blob/4b67e36a4aaa29e542929be7a57cf54fd5ce4c44/JS/firebase.js#L62-L66
You can collect all inputs from a form using #elements
method, reference here
https://github.com/mohamednaser/library/blob/4b67e36a4aaa29e542929be7a57cf54fd5ce4c44/index.html#L154-L158
First of all this a good project made with clean code!
It's hard to find great improvements, so I have to pinpoint style suggestions and not actual problems. So in the comments, I will put some suggestions.