Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6290

Ramda: Remove empty object having dynamic keys

$
0
0

I have this object where addon_sizes keys are dynamic i.e "1","2", "3", "4":

const sizes = {"addon_sizes": {"1": ["a", "b"],"2": ["c"],"3": null,"4": []    }}

I need to remove all key/value pairs in this object where the value is null/undefined/empty array.

So the keys "3" and "4" should be removed from the list.

So far what i have tried is:

const newObj = R.reject(R.anyPass([R.isEmpty, R.isNil]))(sizes.addon_sizes);

But this doesn't remove the null or empty values.


Viewing all articles
Browse latest Browse all 6290

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>