These are chat archives for ramda/ramda

Jun 2016
David Langford
Jun 13 2016 00:17
Though I am using import
Tushar Mathur
Jun 13 2016 14:55
export const DownloadFromMeta = ({HTTP, meta$}) => {
  const threads = (meta) =>, index) => ({meta, index}))
  const Offset = ({meta, index}) => meta.offsets[index]
  return R.compose(
    Rx.flatMap(({meta, index}) => {
     // Refactor to make it simpler
      const addIndex = R.merge({index})
      const offset = Offset({meta, index})
      const requestParams = CreateRequestParams({meta, index})
      return R.compose(, RequestDataOffsetKV)({HTTP, requestParams, offset})
I am trying to make this code inside of flatMap simpler.
Is there some useful function that I can use from Ramda that can make some significant changes
Tushar Mathur
Jun 13 2016 15:05
I particularly want the two functions — CreateRequestParams and RequestDataOffsetKV out of this function. They are already being unit tested and testing DownloadFromMeta retests those functions.
Jun 13 2016 20:20
I don't see how you could pull those functions out. Out of curiosity, what is it that you're hoping Ramda will do for you in this instance? You're creating a flatMap out of a function composition. What would you hope Ramda do for you?
Jun 13 2016 20:26
Well, if the function you're feeding to Rx.flatMap doesn't rely on any type of variable capturing, you could pull it out of the function you're using it in. You might be able to instantiate the composition at require time.