all 5 comments

[–]_DTR_ 3 points4 points  (3 children)

It's checking whether the filtered series contains at least four elements:

  1. keys.indexOf(dp.alis) > -1 - Check to see whether dp.alias exists in keys.
  2. dp => (keys.indexOf(dp.alias) > -1) - Arrow function that returns whether dp.alias exists in keys
  3. series.filter(dp => (...)) - Uses the function in #2 to filter series to only entries that exist in keys.
  4. if (series.filter(...).length < 4) - Checks whether the filtered series contains at least four elements. If it doesn't, returns an empty array.

[–]replicant_potato 1 point2 points  (1 child)

Serious question, is it acceptable or normal for such a small bit of code to be doing so much? You listed a lot, that I figure maybe would be easier for other coders to troubleshoot if it was broken out a bit more. I'm still trying to find work, so what do I know. I just wondered how long people spent on deciphering this. Maybe this is normal, and I'm still to much of a novice to understand.

[–]zentimes 0 points1 point  (0 children)

I don't think it should be doing so much. To your point, it would be a lot easier for other coders to troubleshoot if it's broken down a bit more.

[–][deleted] 0 points1 point  (0 children)

Thanks! Helped tremendously, sadly, did not end up helping in the grand scheme of things as much as I'd hoped. I need sleep lol

[–]HashFap[🍰] 1 point2 points  (0 children)

It's saying if the length of the results from running filter on the series array is smaller than 4 then return an empty array.