E
E
Egor Mikheev2018-03-15 10:54:09
JavaScript
Egor Mikheev, 2018-03-15 10:54:09

How to pass an argument to one of the composition functions of the Ramda library?

Hello, is there a way to pass arguments to one of the functions included in the composition of the Ramda library?
Here is an example
- there is an array of filter objects

const filter = [
  {
    "name": "custName",
    "value": "\"8905040452, 2810003613\""
  },
  {
    "name": "region",
    "value": "[9,34,25,4,96,15,120,83,105,122,35,81,12,95,2,14,86,101,82,23,118]"
  }
]

- I use a function to extract specific values. specific cutoff filter
const filterInnR = R.compose(
  R.pluck('value'),
  R.filter(R.where({
      name:R.equals('custName')
    })
    )
  )

console.log(filterInnR(filter))

- Is it possible to somehow make this function universal by passing to it, as one of the arguments, the argument of the field name by which the values ​​\u200b\u200bmust be extracted?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question