monolite
monolite copied to clipboard
Add support for collection mapping
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
)