How to concat two arrays in Ramda.js?
I have next data:
const inputData = {
content: [
{
info: ['Test-1-1', 'test-1-2'],
moreInfo: ['foo', 'bar'],
firstName: 'first',
lastName: 'lst',
notes: 'Some info goes here'
},
{
info: ['Test-2-1', 'test-2-2'],
moreInfo: ['foo-2', 'bar-2'],
firstName: 'first',
lastName: 'lst',
notes: 'Some info goes here-2'
},
]
}
I can manipulate this data just fine, but I cannot combine two arrays into one.
What I need to do, is to take
info: ['Test-2-1', 'test-2-2'],
moreInfo: ['foo-2', 'bar-2'],
End return
"theInfo": ["Test-1-1", "test-1-2", "foo", "bar"]
My code:
const allInfo = (R.props(['info', 'moreInfo']));
const returnNewObject = R.applySpec({
// More code here to do other stuff
theInfo: allInfo,
})
R.map(returnNewObject, inputData.content)
What I get:
{
// other info
"theInfo": [["Test-1-1", "test-1-2"], ["foo", "bar"]]
}
What I've tried:
- use example from documentation
R.concat([4, 5, 6], [1, 2, 3]);
But it returns array of empty object, for some reasons it doesn't work like in the documentation