Q:

How do you get all the value in an object using ramda

how do you map to all the object and get all the value using ramda
const input ={
  a: 'apple',
  b:{
    c:{
      d:{
        e: 'egg',
        f: 'fish'
      }
    },
    g: 'guava',
    h: 'honey',
  }
}

console.log :
['apple',
'egg',
'fish',
'guava',
'honey']

A:

You can use Object.values(), and Array.flatMap() to create a recursive function that gets the values from an object, and then iterates the values, and calls itself on every value that is an object:

const getDeepValues = obj => Object
  .values(obj)
  .flatMap(v => typeof v === 'object' ?  getDeepValues(v) : v)

const input = {"a":"apple","b":{"c":{"d":{"e":"egg","f":"fish"}},"g":"guava","h":"honey"}}

const result = getDeepValues(input)

console.log(result)

You can create a pointfree function with Ramda, that does the same thing:

Get the values, 
Use R.When with R.is(Object) to check if the value is an object, and call getDeepValues on the value if it is (the arrow function is needed because the getDeepValues is not declared yet), or return the value if it's not. 

const { pipe, values, chain, when, is } = R

const getDeepValues = pipe(
  values, // get the values
  chain(when(is(Object), v => getDeepValues(v))) // if the value is an object use getDeepValues or just return the value
)

const input = {"a":"apple","b":{"c":{"d":{"e":"egg","f":"fish"}},"g":"guava","h":"honey"}}

const result = getDeepValues(input)

console.log(result)
<script src="https://cdnjs.cloudflare.com/ajax/libs/ramda/0.26.1/ramda.js"></script>

