omni icon indicating copy to clipboard operation
omni copied to clipboard

standardize use of arrow functions, scoped vars and for loops where possible, content.js

Open yoroshikun opened this issue 2 years ago • 1 comments

DO NOT MERGE WITHOUT CHECKING IF ALL FUNCTIONS WORK PLEASE It is important to test this commit as there is some changes that might break things.

This commit only affects the content.js, I have done the following

  • Converted all function declarations to arrow functions where possible (some need for this var)
  • Swapped all variables with scoped ones (es6) standard, helps with reducing bugs as well
  • Converted where possible forEach loops to for (in) for readability and performance == to === as its safer to do a non loose equal, and we know we don't need loose

yoroshikun avatar Jan 16 '22 00:01 yoroshikun

I was thinking about adding some tests to the code base, this would potentially help such refactors. I can give a try on the test setup, what do you think @alyssaxuu ?

marabesi avatar Apr 18 '22 10:04 marabesi