`mapObjIndex` cannot convert undefined or null to object
tuckergordon opened this issue · 4 comments
The following works in ramda: (REPL)
// INPUT
const myObj = {
foo: {
bar: {
a: {
myProp: 'some value'
},
b: {
myProp: 'some other value'
}
}
}
};
// RAMDA
const result = R.pipe(
R.path(['foo', 'bar']),
R.defaultTo({}),
R.mapObjIndexed((val, key) => ({ key, ...val })),
R.values
);
Result:
[
{
"key": "a",
"myProp": "some value"
},
{
"key": "b",
"myProp": "some other value"
}
]
However, the same code in the rambda REPL results in an error coming from R.mapObjIndexed
Cannot convert undefined or null to object
at keys (<anonymous>)
Still digging into this more to try to pinpoint exactly what is causing the problem, but figured it was worth reporting in the meantime
Thanks for the report. I will look into it, but it is very possible that issue is with REPL, rather than with the library itself.
Ah sorry should've clarified that it's happening with the library itself too - just figured the REPL would be easiest for replicating. Appreciate you looking into this!
The function was missing currying logic. A fix is applied and it will be released with 7.2.0
. Again, thank you for the report.
Closing the issue as fix was released with 7.2.0