Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | 1x 56x 2x 54x 92x 4x 88x 101x 101x 4248x 4248x 4248x 92015x 93x | export const strideWindowed = (stride: number) => {
if (stride < 1) {
throw Error(`stride must not be less than 1. (${stride} given)`);
}
return (windowSize: number) => {
if (windowSize < 1) {
throw Error(`windowSize must not be less than 1. (${windowSize} given)`);
}
return <T>(array: T[]): T[][] => {
const result = [];
for (let i = 0; i <= array.length - windowSize; i+=stride) {
const window: T[] = [];
result.push(window);
for (let j = i; j < i + windowSize; j++) {
window.push(array[j]);
}
}
return result;
};
};
};
|