I have input like that:
{
a: [obj1, obj2, obj3...],
b: [obj1, obj2, obj3...],
c: [obj1, obj2, obj3...]
}
I want to have that output (only first object from array for every key)
{
a: [obj1],
b: [obj1],
c: [obj1]
}
I want to do it using ramda.js
The simplest answer is just map(head, obj)
, or if you want a reusable function, map(head)
.
You can see this in action on the Ramda REPL.
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