into
Summary
Transform a list into another list.
Tip
This function is curried.
Description
Reduces a list into another list (not necessarily of the same type)
by applying a serie of transformations (transducer
) to each value
of the list in a single iteration. The transducer is defined by composing
list functions together. Be aware that due to the nature of transducers
the order of execution will be left to right.
Examples
Map over the elements and accumulate into a string:
1 2 |
|
Map over the properties and accumulate into an array:
1 2 |
|
Transducer example: take only the first two elements, increment them and accumulate into a string:
1 2 |
|
Parameters
Name | Type | Description |
---|---|---|
init | Array , Object or string |
|
transducer | function |
|
xs | Array or Object |
Return
Array
, Object
or string