I want to stop using lodash.js
and switch to ramda.js
but I don't see any function like _.toArray()
for objects, is there something like this in ramda
that I should compose or should I continue using lodash
for these functions (and possibly more cases that I have not run into yet.)
For example
In lodash
if you have an Object like :
{"key1": {"inner": "val"}, "key2" : {"inner": "val"}}
you can convert it to an array like this:
[{"inner": "val"}, {"inner": "val"}]
using the function _.toArray()
Well, Ramda has values
, which seems to be what you're looking for:
var obj = {"key1": {"inner": "val"}, "key2" : {"inner": "val"}};
R.values(obj); //=> [{"inner": "val"}, {"inner": "val"}]
But it's pretty unclear from the lodash documentation, what kinds of values _.toArray
function accepts, so this might not be a complete replacement.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With