whatadewitt / yahoo-fantasy-sports-api

NodeJS wrapper for the Yahoo! Fantasy Sports API
https://yahoo-fantasy-node-docs.vercel.app/
MIT License
192 stars 52 forks source link

Cleanup helper functions #57

Closed mikerudolph closed 4 years ago

mikerudolph commented 4 years ago

I noticed that you had some comments in the code for cleanup on helper functions.

I started going through them and with the combination of Object.values and Array.reduce I was able to achieve the object formatting you wanted and also remove the dependency on pulling a count value from the API Response. I know that JavaScript object property order is predictable but it still seemed gross and cleaned up the code a bit.

.. inside mapScoreboard I was also able to reduce the array iterations from 4 to 3... still some work we can likely do there though.

All tests run and pass Executed 98 of 98 specs SUCCESS in 0.214 sec.

mikerudolph commented 4 years ago

I will fix this tomorrow thanks for the comments

mikerudolph commented 4 years ago

This PR has been updated to address the called out bug, tests have been added.