smpoulsen / focus

Lightweight Elixir lenses

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is it possible to target multiple / all items in a list in a generic way?

mindreframer opened this issue · comments

Hey, thanks for focus, this is quite superb way to deal with large payloads!

I have one question and I could not answer it after looking through Readme / codebase / tests.

Given the following datastructure:

payload = %{
items: [
  %{id: 1, price: 12.99}, 
  %{id: 2, price: 34.60}, 
  %{id: 3, price: 99.28}, 
]
}

how can one

  • convert all ids to strings?
  • collect all prices?
  • round up prices?
  • etc... ?

Does focus support targeting all items in a list in a generic way, means without explicit index option?

Thanks and have a nice day!
Roman