mishajw / vaxtldr.uk

https://vaxtldr.uk
7 stars 3 forks source link

Modernise some JS #21

Closed ChrisLane closed 3 years ago

ChrisLane commented 3 years ago

Side note: csv not being immutable, needing to load the file twice due to filtering/mapping operations is annoying #ImmutableByDefault

vercel[bot] commented 3 years ago

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/mishajw/vaxtldr-uk/5vhKgsTMwqmdd6WRcsmSQcptv7xb
✅ Preview: https://vaxtldr-uk-git-fork-chrislane-clean-js-mishajw.vercel.app

ChrisLane commented 3 years ago

Obviously this is personal preference. :shrug:

mishajw commented 3 years ago

Side note: csv not being immutable, needing to load the file twice due to filtering/mapping operations is annoying #ImmutableByDefault

Hmm, not sure if the CSV objects are mutable or not, but I don't think we modify them at all. AFAIU, the filter/map/etc. functions are the standard list functions, and don't mutate the underlying object. We only load each CSV once though - there are two, latest.csv and line.csv - maybe that's the problem you saw?

ChrisLane commented 3 years ago

Side note: csv not being immutable, needing to load the file twice due to filtering/mapping operations is annoying #ImmutableByDefault

Hmm, not sure if the CSV objects are mutable or not, but I don't think we modify them at all. AFAIU, the filter/map/etc. functions are the standard list functions, and don't mutate the underlying object. We only load each CSV once though - there are two, latest.csv and line.csv - maybe that's the problem you saw?

Ah yep, I read them both as being latest.csv so that will have been the issue, however, filter will return a new collection but the objects within that collection still reference the same as before I think. If it's just primitives then the whole thing will be new.

ChrisLane commented 3 years ago

WOOP WOOP! :tada: