Allows to map a slice of the array for each item in the array.
Usage
const mapSlice = ; ;// => [ '1', '1-2', '1-2-3' ]
Or if you want to create slices from the right use mapSliceRight
:
const mapSlice = ; mapSlice;// => [ '1-2-3', '2-3', '3' ]
Installation
npm install array-map-slice
API
mapSlice(input, mapper) / mapSliceRight(input, mapper)
Returns a new array with values returned by the mapper function.
input
Type: Array
Iterated over in the mapper
function which gets splices of it.
mapper (slice, index, array)
Type: Function
Executed for every slice and expected to return the new value.
License
MIT © Florian Goße