-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify code #7
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! You're right that there was no real reason for the promise statements to be used in such a way, either I had something different in mind when I first wrote the functions or I just didn't understand promises as well at the time. I'll be making the changes I'm suggesting below myself and doing some manual tests before merging everything.
Just one thing of note, in the project's ESLint file there is a rule instructing that semicolons shouldn't be used. I know it's a matter of preference but I'll be removing the ones you added for consistency.
So I was looking about the source code and noticed it was more verbose than it needed to be, so I cleaned it up. This was just an update of syntax and removing unnecessary Promise hell - everything should work as it did before, but there aren't any tests defined that I could tell - I will probably work on writing tests when I next have the time.
edit: It's worth pointing out that this re-write is still arguably more verbose than it needs to be - you could remove the word "async" from all of the functions and it would be the same since await is never used, but in my subjective opinion async keyword is a good way to indicate via code that a function returns a promise.