StockAlertBot icon indicating copy to clipboard operation
StockAlertBot copied to clipboard

Update code

Open Sup3820 opened this issue 1 year ago • 2 comments

Small updates to improve code, fix small bugs, better readability

Sup3820 avatar Mar 05 '23 21:03 Sup3820

I browsed the changes briefly but please do me a favor. Could you run npm run prettierAll and then npm run eslintFixAll? This will make sure the formatting matches and will make it much easier for me to see the changes.

Thanks!

Prince25 avatar Mar 06 '23 06:03 Prince25

The current code changes seem to be rewritten for conciseness, no? If there's any bug fixes, can you point out where they are?

From what I've gathered:

  • require changed to import
  • moved imports and constants to the top
  • took out some console statements
  • used arrow functions inside app.get
  • changed undefined to null
  • getPage() revision
  • extractInformation() revision

While I totally agree your changes do make the code easier to read and follow, there are reasons for structuring/writing it the way I did. I wanted to be clear about what the code does and what the program is doing when launched (for debugging and newbie purposes). It didn't make sense to me to import all modules if an environment file is not found. As for import vs require, I usually prefer import but there are good reasons to use require.

However, I will incorporate some of your changes like using arrow functions inside app.get, app.listen being at the end, and perhaps getPage and extractInformation function changes once I test them out.

Prince25 avatar Mar 07 '23 00:03 Prince25