Skip to content

Add support for collection mapping #38

Description

@kube

Currently mapping a collection using set is quite verbose and ugly:

// Current
return set(
  response,
  _ => _.results,
  xs =>
    xs.map(result =>
      set(
        result,
        _ => _.poster_path,
        path => 'http://image.tmdb.org/t/p/w185' + path
      )
    )
)

Proposal

set should accept multiple accessor function before the value transformer.
The first ones should only target arrays.
This would result in a much cleaner syntax:

// With map support
return set(
  response,
  _ => _.results,
  _ => _.poster_path,
  path => 'http://image.tmdb.org/t/p/w185' + path
)

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions