How to convert an array of objects in an array of integers extracting values from those objects using ramda.js?

Ric*_*uan 1 javascript ramda.js

I'm trying to convert an array of objects into an array of integers extracting values from those objects using Ramda.js. I need to keep just the node participants with the uid values, however, it seems that I'm not doing this correctly.

I'm want to transform this

var listObejcts = {
  "participants": [
    {
      "entity": {
        "uid": 1
      }
    },
    {
      "entity": {
        "uid": 2
      }
    }
  ]
}
Run Code Online (Sandbox Code Playgroud)

to this:

{
  "participants": [1, 2]
}
Run Code Online (Sandbox Code Playgroud)

I've tried the code above but it didn't work. It's still returning a list of objects.

var transform = pipe(
  over(lensProp('participants'), pipe(
    filter(pipe(
      over(lensProp('entity'), prop('uid'))
    ))
  ))
)

console.log(transform(listObejcts))
Run Code Online (Sandbox Code Playgroud)

Does anybody know how I could achieve that?

It's possible to edit the code here - https://repl.it/repls/PrimaryMushyBlogs

Sco*_*yet 5

One possibility is to combine evolve with map(path) like this:

const transform = evolve({participants: map(path(['entity', 'uid']))})

var listObjects = {participants: [{entity: {uid: 1}}, {entity: {uid: 2}}]}

console.log(transform(listObjects))
Run Code Online (Sandbox Code Playgroud)
<script src="https://bundle.run/ramda@0.26.1"></script><script>
const {evolve, map, path} = ramda  </script>
Run Code Online (Sandbox Code Playgroud)

While I'm sure that there is a lens-based solution, this version looks pretty straightforward.

Update

A lens-based solution is certainly possible. Here is one such:

var transform = over(
  lensProp('participants'), 
  map(view(lensPath(['entity', 'uid'])))
)

var listObjects = {participants: [{entity: {uid: 1}}, {entity: {uid: 2}}]}

console.log(transform(listObjects))
Run Code Online (Sandbox Code Playgroud)
<script src="https://bundle.run/ramda@0.26.1"></script><script>
const {over, lensProp, map, view, lensPath} = ramda  </script>
Run Code Online (Sandbox Code Playgroud)