hfg-gmuend / gmynd

A utility library for working with data in Javascript
15 stars 1 forks source link

deleteIncompleteData (data, props) #10

Closed sandyisabeau closed 3 years ago

sandyisabeau commented 3 years ago

Would it be possible to add "NA" as a missing property? I wanted to filter the medals, but had some issues since NA isn't included. Thank you!

Screenshot 2021-05-22 at 19 21 36
caitoor commented 3 years ago

Excellent question! "NA" can't be added to the blacklist as, in some cases, it refers e.g. to North America. We can actually discuss the string "N/A" to be seen as incomplete data (but I tend not to). Apart from that, you are indeed right: The current library doesn't have any function to delete data entries by a given key-value pair. I see three different approaches that could be implemented:

I think the third option would be the smoothest, what do you think?

caitoor commented 3 years ago

With the new update you should now be able to use medalData = gmynd.deleteIncompleteData(medalData, "Medal", "NA"). Is that what you were looking for?

sandyisabeau commented 3 years ago

Yes, that's what I was looking for:) I was able to sort and delete the missing medals already, but I'll try it out with the new update. Thank you:)