UNPKG

moy-fp

Version:
18 lines (15 loc) 325 B
import curry from '../Function/curry' /** * Number -> [a] -> [[a]] */ const aperture = curry( (n, array) => { const limit = array.length - n + 1, list = []; for(let index = 0; index < limit; index ++){ list.push(array.slice(index, index + n)) } return list } ) export default aperture